diff --git a/hash/pc98_cd.xml b/hash/pc98_cd.xml
index 4ed77ab3d70..35e7aa01736 100644
--- a/hash/pc98_cd.xml
+++ b/hash/pc98_cd.xml
@@ -13,739 +13,8 @@
-->
-
-
- Alone in the Dark 2
- 1994
- アローマイクロテックス (Arrow Micro-Techs)
-
-
-
-
-
-
+
-
-
- Branmarker 2
- 1995
- ディー・オー (D.O.)
-
-
-
-
-
-
-
-
-
- Brandish Renewal
- 1995
- 日本ファルコム (Nihon Falcom)
-
-
-
-
-
-
-
-
-
- Brandish VT
- 1996
- 日本ファルコム (Nihon Falcom)
-
-
-
-
-
-
-
-
-
- Cry Sweeper
- 1996
- ディー・オー (D.O.)
-
-
-
-
-
-
-
-
-
-
- Dangel
- 1996
- ミンク (Mink)
-
-
-
-
-
-
-
-
-
- Disc Station Vol. 09
- 1995
- コンパイル (Compile)
-
-
-
-
-
-
-
-
-
- Disc Station Vol. 10
- 1996
- コンパイル (Compile)
-
-
-
-
-
-
-
-
-
- Disc Station Vol. 11
- 1996
- コンパイル (Compile)
-
-
-
-
-
-
-
-
-
- Doom
- 1995
- イマジニア (Imagineer)
-
-
-
-
-
-
-
-
-
- Doom II
- 1995
- イマジニア (Imagineer)
-
-
-
-
-
-
-
-
-
- Finish Hold 2 - Tag
- 1996
- システムソフト (SystemSoft)
-
-
-
-
-
-
-
-
-
- Galpani
- 1995
- Creo I
-
-
-
-
-
-
-
-
-
- Giten Megami Tensei - Tokyo Mokushiroku
- 1997
- アスキー (ASCII)
-
-
-
-
-
-
-
-
-
- GuynaRock R
- 1997
- ソニア (Sogna)
-
-
-
-
-
-
-
-
-
- Let's! Pirates
- 1997
- ジックス (ZyX)
-
-
-
-
-
-
-
-
-
- Golf Links 386 Pro
- 1995
- サイベル (Cybelle)
-
-
-
-
-
-
-
-
-
- Akai Shizuku - The Legend of Heroes IV
- 1996
- 日本ファルコム (Nihon Falcom)
-
-
-
-
-
-
-
-
-
- Chou Jikuu Yousai Macross - SkullLeader Complete Pack
- 1995
- ファミリーソフト (Family Soft)
-
-
-
-
-
-
-
-
-
- Might and Magic - Clouds of Xeen
- 1993
- スタークラフト (Starcraft)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Panzer General
- 1995
- AMT Savan
-
-
-
-
-
-
-
-
-
- Photo Genic
- 1997
- サンソフト (Sunsoft)
-
-
-
-
-
-
-
-
-
- Policenauts
- 1994
- コナミ (Konami)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Puyo Puyo Tsuu
- 1995
- コンパイル (Compile)
-
-
-
-
-
-
-
-
-
- RPG Tkool Dante98 II
- 1996
- アスキー (ASCII)
-
-
-
-
-
-
-
-
-
- Mahou Shoujo Pretty Samy - Zenpen
- 1995
- AIC
-
-
-
-
-
-
-
-
-
- Strike Commander Plus
- 1995
- エレクトロニック・アーツ・ビクター (Electronic Arts Victor)
-
-
-
-
-
-
-
-
-
- TFX - The Cutting Edge of Aerial Combat (Japan)
- 1996
- イマジニア (Imagineer)
-
-
-
-
-
-
-
-
-
- Tokio 2 - Kaitaku Imin Boshuuchuu!
- 1995
- アートディンク (Artdink)
-
-
-
-
-
-
-
-
-
- The Horde
- 1995
- アローマイクロテックス (Arrow Micro-Techs)
-
-
-
-
-
-
-
-
-
- Theme Park
- 1995
- エレクトロニック・アーツ・ビクター (Electronic Arts Victor)
-
-
-
-
-
-
-
-
-
- Viper F40
- 1997
- ソニア (Sogna)
-
-
-
-
-
-
+
+
+
+ Alone in the Dark 2
+ 1994
+ アローマイクロテックス (Arrow Micro-Techs)
+
+
+
+
+
+
+
+
+
+
+
+ Akiko Gold - The Queen of Adult
+ 1995
+ フェアリーテール レッドゾーン (Fairytale Red-Zone)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Blandia 98
+ 1995
+ ビング (Ving)
+
+
+
+
+
+
+
+
+
+
+
+
+ Branmarker 2
+ 1995
+ ディー・オー (D.O.)
+
+
+
+
+
+
+
+
+
+
+
+ Brandish Renewal
+ 1995
+ 日本ファルコム (Nihon Falcom)
+
+
+
+
+
+
+
+
+
+
+
+ Brandish VT
+ 1996
+ 日本ファルコム (Nihon Falcom)
+
+
+
+
+
+
+
+
+
+
+
+ Cry Sweeper
+ 1996
+ ディー・オー (D.O.)
+
+
+
+
+
+
+
+
+
+
+
+
+ Dangel
+ 1996
+ ミンク (Mink)
+
+
+
+
+
+
+
+
+
+
+
+ Disc Station Vol. 09
+ 1995
+ コンパイル (Compile)
+
+
+
+
+
+
+
+
+
+ Disc Station Vol. 10
+ 1996
+ コンパイル (Compile)
+
+
+
+
+
+
+
+
+
+ Disc Station Vol. 11
+ 1996
+ コンパイル (Compile)
+
+
+
+
+
+
+
+
+
+ Doom
+ 1995
+ イマジニア (Imagineer)
+
+
+
+
+
+
+
+
+
+
+ Doom II
+ 1995
+ イマジニア (Imagineer)
+
+
+
+
+
+
+
+
+
+
+ Emit Vol. 1 - Toki no Maigo
+ 1994
+ 光栄 (Koei)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Emit Vol. 2 - Inochigake no Tabi
+ 1995
+ 光栄 (Koei)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Emit Vol. 3 - Watashi ni Sayonara o
+ 1995
+ 光栄 (Koei)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ F-117A Nighthawk - Stealth Fighter 2.0
+ 1995
+ スペクトラムホロバイトジャパン (Spectrum HoloByte Japan)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Finish Hold 2 - Tag
+ 1996
+ システムソフト (SystemSoft)
+
+
+
+
+
+
+
+
+
+
+ Galpani
+ 1995
+ クレオ・アイ (Creo I)
+
+
+
+
+
+
+
+
+
+
+ Giten Megami Tensei - Tokyo Mokushiroku
+ 1997
+ アスキー (ASCII)
+
+
+
+
+
+
+
+
+
+
+
+ GuynaRock R
+ 1998
+ ソニア (Sogna)
+
+
+
+
+
+
+
+
+
+
+
+ Inherit the Earth - Arashi no Orb
+ 1995
+ スタークラフト (Starcraft)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Let's! Pirates
+ 1997
+ ジックス (ZyX)
+
+
+
+
+
+
+
+
+
+
+
+ Golf Links 386 Pro
+ 1995
+ サイベル (Cybelle)
+
+
+
+
+
+
+
+
+
+
+
+ Lodoss Tou Senki CD - Haiiro no Majo
+ 1993
+ ハミングバード (HummingBird)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Akai Shizuku - The Legend of Heroes IV
+ 1996
+ 日本ファルコム (Nihon Falcom)
+
+
+
+
+
+
+
+
+
+
+
+ Chou Jikuu Yousai Macross - SkullLeader Complete Pack
+ 1995
+ ファミリーソフト (Family Soft)
+
+
+
+
+
+
+
+
+
+
+
+ Might and Magic - Clouds of Xeen
+ 1993
+ スタークラフト (Starcraft)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Panzer General
+ 1995
+ エーエムティーサヴァン (AMT Savan)
+
+
+
+
+
+
+
+
+
+
+
+ Photo Genic
+ 1997
+ サンソフト (Sunsoft)
+
+
+
+
+
+
+
+
+
+
+
+ Policenauts
+ 1994
+ コナミ (Konami)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Puyo Puyo Tsuu
+ 1995
+ コンパイル (Compile)
+
+
+
+
+
+
+
+
+
+
+
+ LOGiN Disk & Book - RPG Tsukuruu Dante98 II
+ 1996
+ アスキー (ASCII)
+
+
+
+
+
+
+
+
+
+ Mahou Shoujo Pretty Sammy - Zenpen
+ 1995
+ AICスピリッツ (AIC Spirits)
+
+
+
+
+
+
+
+
+
+
+
+ Sela
+ 1995
+ ハーベスト (Hervest)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Shamhat - The Holy Circlet
+ 1994
+ データウエスト (Data West)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Super Real Mahjong P4 Final
+ 1995
+ ビング (Ving)
+
+
+
+
+
+
+
+
+
+
+
+
+ Strike Commander Plus
+ 1995
+ エレクトロニック・アーツ・ビクター (Electronic Arts Victor)
+
+
+
+
+
+
+
+
+
+
+
+
+ Takeru Doujin CD-ROM Vol. 1
+ 199?
+ タケル (Takeru)
+
+
+
+
+
+
+
+
+
+ TFX - The Cutting Edge of Aerial Combat (Japan)
+ 1996
+ イマジニア (Imagineer)
+
+
+
+
+
+
+
+
+
+
+ Tokio 2 - Kaitaku Imin Boshuuchuu!
+ 1995
+ アートディンク (Artdink)
+
+
+
+
+
+
+
+
+
+
+
+ The Horde
+ 1995
+ アローマイクロテックス (Arrow Micro-Techs)
+
+
+
+
+
+
+
+
+
+
+
+ Theme Park
+ 1995
+ エレクトロニック・アーツ・ビクター (Electronic Arts Victor)
+
+
+
+
+
+
+
+
+
+
+
+ U.S. Navy Fighters Gold
+ 1996
+ エレクトロニック・アーツ・ビクター (Electronic Arts Victor)
+
+
+
+
+
+
+
+
+
+
+
+ Viper F40
+ 1997
+ ソニア (Sogna)
+
+
+
+
+
+
+
+
+
+
+ Yume no Sei
+ 1996
+ 13cm
+
+
+
+
+
+
+
+
+
+ Zenith - Full Animation Adventure Series #1
+ 1994
+ 姫屋ソフト (Himeya Soft)
+
+
+
+
+
+
+
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 571c75fd48b..5fdd355a955 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -2074,6 +2074,22 @@ if (BUSES["SEGA8"]~=null) then
}
end
+---------------------------------------------------
+--
+--@src/devices/bus/sg1000_exp/sg1000exp.h,BUSES["SG1000_EXP"] = true
+---------------------------------------------------
+
+if (BUSES["SG1000_EXP"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/bus/sg1000_exp/sg1000exp.cpp",
+ MAME_DIR .. "src/devices/bus/sg1000_exp/sg1000exp.h",
+ MAME_DIR .. "src/devices/bus/sg1000_exp/sk1100.cpp",
+ MAME_DIR .. "src/devices/bus/sg1000_exp/sk1100.h",
+ MAME_DIR .. "src/devices/bus/sg1000_exp/fm_unit.cpp",
+ MAME_DIR .. "src/devices/bus/sg1000_exp/fm_unit.h",
+ }
+end
+
---------------------------------------------------
--
--@src/devices/bus/sms_ctrl/smsctrl.h,BUSES["SMS_CTRL"] = true
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua
index 2119d2b30f7..df58452777d 100644
--- a/scripts/target/mame/arcade.lua
+++ b/scripts/target/mame/arcade.lua
@@ -642,6 +642,7 @@ BUSES["SAT_CTRL"] = true
BUSES["SCSI"] = true
--BUSES["SCV"] = true
BUSES["SEGA8"] = true
+BUSES["SG1000_EXP"] = true
BUSES["SMS_CTRL"] = true
BUSES["SMS_EXP"] = true
--BUSES["SNES"] = true
@@ -3050,6 +3051,8 @@ files {
MAME_DIR .. "src/mame/machine/s32comm.h",
MAME_DIR .. "src/mame/machine/m1comm.cpp",
MAME_DIR .. "src/mame/machine/m1comm.h",
+ MAME_DIR .. "src/mame/machine/m2comm.cpp",
+ MAME_DIR .. "src/mame/machine/m2comm.h",
MAME_DIR .. "src/mame/audio/dsbz80.cpp",
MAME_DIR .. "src/mame/audio/dsbz80.h",
MAME_DIR .. "src/mame/drivers/model2.cpp",
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua
index 76b52c9f669..1063bd71a93 100644
--- a/scripts/target/mame/mess.lua
+++ b/scripts/target/mame/mess.lua
@@ -666,6 +666,7 @@ BUSES["SATURN"] = true
BUSES["SCSI"] = true
BUSES["SCV"] = true
BUSES["SEGA8"] = true
+BUSES["SG1000_EXP"] = true
BUSES["SMS_CTRL"] = true
BUSES["SMS_EXP"] = true
BUSES["SNES"] = true
diff --git a/src/devices/bus/gamegear/smsctrladp.cpp b/src/devices/bus/gamegear/smsctrladp.cpp
index 54b9139b433..2aec892b279 100644
--- a/src/devices/bus/gamegear/smsctrladp.cpp
+++ b/src/devices/bus/gamegear/smsctrladp.cpp
@@ -45,7 +45,7 @@ void sms_ctrl_adaptor_device::device_start()
//-------------------------------------------------
-// sms_peripheral_r - rapid fire read
+// sms_peripheral_r - sms_ctrl_adaptor read
//-------------------------------------------------
UINT8 sms_ctrl_adaptor_device::peripheral_r()
@@ -55,7 +55,7 @@ UINT8 sms_ctrl_adaptor_device::peripheral_r()
//-------------------------------------------------
-// sms_peripheral_w - rapid fire write
+// sms_peripheral_w - sms_ctrl_adaptor write
//-------------------------------------------------
void sms_ctrl_adaptor_device::peripheral_w(UINT8 data)
diff --git a/src/devices/bus/sega8/sega8_slot.h b/src/devices/bus/sega8/sega8_slot.h
index 439bc3be7a2..7e00a20bb27 100644
--- a/src/devices/bus/sega8/sega8_slot.h
+++ b/src/devices/bus/sega8/sega8_slot.h
@@ -199,7 +199,7 @@ public:
MCFG_DEVICE_ADD(_tag, SEGA8_CART_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
static_cast(device)->set_mandatory(FALSE); \
- static_cast(device)->set_intf("sms_cart"); \
+ static_cast(device)->set_intf("sms_cart,sg1000_cart"); \
static_cast(device)->set_ext("bin,sms,sg");
#define MCFG_SMS_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
diff --git a/src/devices/bus/sg1000_exp/fm_unit.cpp b/src/devices/bus/sg1000_exp/fm_unit.cpp
new file mode 100644
index 00000000000..935346e17de
--- /dev/null
+++ b/src/devices/bus/sg1000_exp/fm_unit.cpp
@@ -0,0 +1,119 @@
+// license:BSD-3-Clause
+// copyright-holders:Enik Land
+/**********************************************************************
+
+ Sega FM Sound Unit emulation
+
+
+Release data from the Sega Retro project:
+
+ Year: 1987 Country/region: JP Model code: FM-70
+
+**********************************************************************/
+
+#include "fm_unit.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type SEGA_FM_UNIT = &device_creator;
+
+
+static MACHINE_CONFIG_FRAGMENT( fm_config )
+ MCFG_SOUND_ADD("ym2413", YM2413, XTAL_10_738635MHz/3)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":mono", 1.00)
+MACHINE_CONFIG_END
+
+
+machine_config_constructor sega_fm_unit_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( fm_config );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// sega_fm_unit_device - constructor
+//-------------------------------------------------
+
+sega_fm_unit_device::sega_fm_unit_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, SEGA_FM_UNIT, "Sega FM Sound Unit", tag, owner, clock, "sega_fm_unit", __FILE__),
+ device_sg1000_expansion_slot_interface(mconfig, *this),
+ m_ym(*this, "ym2413"),
+ m_audio_control(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void sega_fm_unit_device::device_start()
+{
+ /* register for state saving */
+ save_item(NAME(m_audio_control));
+}
+
+
+//-------------------------------------------------
+// peripheral_r - fm unit read
+//-------------------------------------------------
+
+READ8_MEMBER(sega_fm_unit_device::peripheral_r)
+{
+ if (offset == 2)
+ {
+ return m_audio_control & 0x01;
+ }
+ // will not be called for other offsets.
+ return 0xff;
+}
+
+//-------------------------------------------------
+// peripheral_w - fm unit write
+//-------------------------------------------------
+
+WRITE8_MEMBER(sega_fm_unit_device::peripheral_w)
+{
+ switch (offset)
+ {
+ case 0: // register port
+ if (m_audio_control == 0x01)
+ {
+ m_ym->write(space, 0, data & 0x3f);
+ }
+ break;
+ case 1: // data port
+ if (m_audio_control == 0x01)
+ {
+ m_ym->write(space, 1, data);
+ }
+ break;
+ case 2: // control port
+ m_audio_control = data & 0x01;
+ break;
+ default:
+ break;
+ }
+}
+
+
+bool sega_fm_unit_device::is_readable(UINT8 offset)
+{
+ return (offset == 2) ? true : false;
+}
+
+
+bool sega_fm_unit_device::is_writeable(UINT8 offset)
+{
+ return (offset <= 2) ? true : false;
+}
+
diff --git a/src/devices/bus/sg1000_exp/fm_unit.h b/src/devices/bus/sg1000_exp/fm_unit.h
new file mode 100644
index 00000000000..5b45b14d831
--- /dev/null
+++ b/src/devices/bus/sg1000_exp/fm_unit.h
@@ -0,0 +1,55 @@
+// license:BSD-3-Clause
+// copyright-holders:Enik Land
+/**********************************************************************
+
+ Sega FM Sound Unit emulation
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SEGA_FM_UNIT__
+#define __SEGA_FM_UNIT__
+
+
+#include "emu.h"
+#include "sound/2413intf.h"
+#include "sg1000exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> sega_fm_unit_device
+
+class sega_fm_unit_device : public device_t,
+ public device_sg1000_expansion_slot_interface
+{
+public:
+ // construction/destruction
+ sega_fm_unit_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+ // device_sg1000_expansion_slot_interface overrides
+ virtual DECLARE_READ8_MEMBER(peripheral_r) override;
+ virtual DECLARE_WRITE8_MEMBER(peripheral_w) override;
+ virtual bool is_readable(UINT8 offset) override;
+ virtual bool is_writeable(UINT8 offset) override;
+
+private:
+ required_device m_ym;
+ UINT8 m_audio_control;
+};
+
+
+// device type definition
+extern const device_type SEGA_FM_UNIT;
+
+
+#endif
diff --git a/src/devices/bus/sg1000_exp/sg1000exp.cpp b/src/devices/bus/sg1000_exp/sg1000exp.cpp
new file mode 100644
index 00000000000..0460efccbef
--- /dev/null
+++ b/src/devices/bus/sg1000_exp/sg1000exp.cpp
@@ -0,0 +1,124 @@
+// license:BSD-3-Clause
+// copyright-holders:Enik Land
+/**********************************************************************
+
+ Sega SG-1000 expansion slot emulation
+
+**********************************************************************/
+
+#include "sg1000exp.h"
+// slot devices
+#include "sk1100.h"
+#include "fm_unit.h"
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type SG1000_EXPANSION_SLOT = &device_creator;
+
+
+
+//**************************************************************************
+// CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_sg1000_expansion_slot_interface - constructor
+//-------------------------------------------------
+
+device_sg1000_expansion_slot_interface::device_sg1000_expansion_slot_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig,device)
+{
+}
+
+
+//-------------------------------------------------
+// ~device_sg1000_expansion_slot_interface - destructor
+//-------------------------------------------------
+
+device_sg1000_expansion_slot_interface::~device_sg1000_expansion_slot_interface()
+{
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// sg1000_expansion_slot_device - constructor
+//-------------------------------------------------
+
+sg1000_expansion_slot_device::sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, SG1000_EXPANSION_SLOT, "Sega SG-1000 expansion slot", tag, owner, clock, "sg1000_expansion_slot", __FILE__),
+ device_slot_interface(mconfig, *this), m_device(nullptr)
+{
+}
+
+
+//-------------------------------------------------
+// sg1000_expansion_slot_device - destructor
+//-------------------------------------------------
+
+sg1000_expansion_slot_device::~sg1000_expansion_slot_device()
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void sg1000_expansion_slot_device::device_start()
+{
+ m_device = dynamic_cast(get_card_device());
+}
+
+
+// Address offsets are masked with 0x07 because the SG-1000 expansion slot
+// has only 3 address lines (A0, A1, A2).
+
+
+READ8_MEMBER(sg1000_expansion_slot_device::read)
+{
+ UINT8 data = 0xff;
+ if (m_device)
+ data = m_device->peripheral_r(space, offset & 0x07);
+ return data;
+}
+
+WRITE8_MEMBER(sg1000_expansion_slot_device::write)
+{
+ if (m_device)
+ m_device->peripheral_w(space, offset & 0x07, data);
+}
+
+
+bool sg1000_expansion_slot_device::is_readable(UINT8 offset)
+{
+ if (m_device)
+ return m_device->is_readable(offset & 0x07);
+ return false;
+}
+
+
+bool sg1000_expansion_slot_device::is_writeable(UINT8 offset)
+{
+ if (m_device)
+ return m_device->is_writeable(offset & 0x07);
+ return false;
+}
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( sg1000_expansion_devices )
+//-------------------------------------------------
+
+SLOT_INTERFACE_START( sg1000_expansion_devices )
+ SLOT_INTERFACE("sk1100", SEGA_SK1100)
+ SLOT_INTERFACE("fm", SEGA_FM_UNIT)
+SLOT_INTERFACE_END
diff --git a/src/devices/bus/sg1000_exp/sg1000exp.h b/src/devices/bus/sg1000_exp/sg1000exp.h
new file mode 100644
index 00000000000..183ee9ea948
--- /dev/null
+++ b/src/devices/bus/sg1000_exp/sg1000exp.h
@@ -0,0 +1,91 @@
+// license:BSD-3-Clause
+// copyright-holders:Enik Land
+/**********************************************************************
+
+ Sega SG-1000 expansion slot emulation
+
+**********************************************************************
+
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SG1000_EXPANSION_SLOT__
+#define __SG1000_EXPANSION_SLOT__
+
+#include "emu.h"
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SG1000_EXPANSION_ADD(_tag, _slot_intf, _def_slot, _fixed) \
+ MCFG_DEVICE_ADD(_tag, SG1000_EXPANSION_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
+#define MCFG_SG1000_EXPANSION_MODIFY(_tag) \
+ MCFG_DEVICE_MODIFY(_tag)
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> sg1000_expansion_slot_device
+
+class device_sg1000_expansion_slot_interface;
+
+class sg1000_expansion_slot_device : public device_t,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~sg1000_expansion_slot_device();
+
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
+ bool is_readable(UINT8 offset);
+ bool is_writeable(UINT8 offset);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+private:
+ device_sg1000_expansion_slot_interface *m_device;
+};
+
+
+// ======================> device_sg1000_expansion_slot_interface
+
+// class representing interface-specific live sg1000_expansion card
+class device_sg1000_expansion_slot_interface : public device_slot_card_interface
+{
+public:
+ // construction/destruction
+ device_sg1000_expansion_slot_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_sg1000_expansion_slot_interface();
+
+ virtual DECLARE_READ8_MEMBER(peripheral_r) { return 0xff; };
+ virtual DECLARE_WRITE8_MEMBER(peripheral_w) { };
+
+ virtual bool is_readable(UINT8 offset) { return true; };
+ virtual bool is_writeable(UINT8 offset) { return true; };
+
+protected:
+ sg1000_expansion_slot_device *m_port;
+};
+
+
+// device type definition
+extern const device_type SG1000_EXPANSION_SLOT;
+
+
+SLOT_INTERFACE_EXTERN( sg1000_expansion_devices );
+
+
+#endif
diff --git a/src/devices/bus/sg1000_exp/sk1100.cpp b/src/devices/bus/sg1000_exp/sk1100.cpp
new file mode 100644
index 00000000000..3c5726f96dc
--- /dev/null
+++ b/src/devices/bus/sg1000_exp/sk1100.cpp
@@ -0,0 +1,337 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Sega SK-1100 keyboard emulation
+
+
+Release data from the Sega Retro project:
+
+ Year: 1984 Country/region: JP Model code: SK-1100
+
+
+TODO:
+- SP-400 serial printer
+- Link between two Mark III's through keyboard, supported by F-16 Fighting Falcon
+
+
+**********************************************************************/
+
+#include "sk1100.h"
+#include "softlist.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type SEGA_SK1100 = &device_creator;
+
+
+/*-------------------------------------------------
+ INPUT_PORTS( sk1100_keys )
+-------------------------------------------------*/
+
+static INPUT_PORTS_START( sk1100_keys )
+ PORT_START("PA0")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENG DIER'S") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT))
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k')
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i')
+
+ PORT_START("PA1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l')
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o')
+
+ PORT_START("PA2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+')
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p')
+
+ PORT_START("PA3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_SMALL_PI) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x03c0)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`')
+
+ PORT_START("PA4")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}')
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{')
+
+ PORT_START("PA5")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PA6")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u')
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j')
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m')
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PB0")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PB1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PB2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PB3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PB4")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('^')
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PB5")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa5") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x00a5)
+ PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNC") PORT_CODE(KEYCODE_TAB)
+
+ PORT_START("PB6")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor sega_sk1100_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( sk1100_keys );
+}
+
+
+static MACHINE_CONFIG_FRAGMENT( sk1100_config )
+ /* devices */
+ MCFG_DEVICE_ADD(UPD9255_0_TAG, I8255, 0)
+ MCFG_I8255_IN_PORTA_CB(READ8(sega_sk1100_device, ppi_pa_r))
+ MCFG_I8255_IN_PORTB_CB(READ8(sega_sk1100_device, ppi_pb_r))
+ MCFG_I8255_OUT_PORTC_CB(WRITE8(sega_sk1100_device, ppi_pc_w))
+
+// MCFG_PRINTER_ADD("sp400") /* serial printer */
+
+ MCFG_CASSETTE_ADD("cassette")
+ MCFG_CASSETTE_FORMATS(sc3000_cassette_formats)
+ MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
+ MCFG_CASSETTE_INTERFACE("sc3000_cass")
+
+ /* software lists */
+ MCFG_SOFTWARE_LIST_ADD("sc3k_cart_list","sc3000_cart")
+ MCFG_SOFTWARE_LIST_ADD("cass_list","sc3000_cass")
+MACHINE_CONFIG_END
+
+
+machine_config_constructor sega_sk1100_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( sk1100_config );
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// sega_sk1100_device - constructor
+//-------------------------------------------------
+
+sega_sk1100_device::sega_sk1100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, SEGA_SK1100, "Sega SK-1100 Keyboard", tag, owner, clock, "sega_sk1100", __FILE__),
+ device_sg1000_expansion_slot_interface(mconfig, *this),
+ m_cassette(*this, "cassette"),
+ m_ppi(*this, UPD9255_0_TAG),
+ m_pa0(*this, "PA0"),
+ m_pa1(*this, "PA1"),
+ m_pa2(*this, "PA2"),
+ m_pa3(*this, "PA3"),
+ m_pa4(*this, "PA4"),
+ m_pa5(*this, "PA5"),
+ m_pa6(*this, "PA6"),
+ m_pb0(*this, "PB0"),
+ m_pb1(*this, "PB1"),
+ m_pb2(*this, "PB2"),
+ m_pb3(*this, "PB3"),
+ m_pb4(*this, "PB4"),
+ m_pb5(*this, "PB5"),
+ m_pb6(*this, "PB6"),
+ m_keylatch(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void sega_sk1100_device::device_start()
+{
+ // find keyboard rows
+ m_key_row[0] = m_pa0;
+ m_key_row[1] = m_pa1;
+ m_key_row[2] = m_pa2;
+ m_key_row[3] = m_pa3;
+ m_key_row[4] = m_pa4;
+ m_key_row[5] = m_pa5;
+ m_key_row[6] = m_pa6;
+ m_key_row[7] = nullptr; // keyboard disabled
+ m_key_row[8] = m_pb0;
+ m_key_row[9] = m_pb1;
+ m_key_row[10] = m_pb2;
+ m_key_row[11] = m_pb3;
+ m_key_row[12] = m_pb4;
+ m_key_row[13] = m_pb5;
+ m_key_row[14] = m_pb6;
+ m_key_row[15] = nullptr; // keyboard disabled
+
+ /* register for state saving */
+ save_item(NAME(m_keylatch));
+}
+
+
+//-------------------------------------------------
+// peripheral_r - keyboard read
+//-------------------------------------------------
+
+READ8_MEMBER(sega_sk1100_device::peripheral_r)
+{
+ return m_ppi->read(space, offset & 0x03);
+}
+
+
+//-------------------------------------------------
+// peripheral_w - keyboard write
+//-------------------------------------------------
+
+WRITE8_MEMBER(sega_sk1100_device::peripheral_w)
+{
+ m_ppi->write(space, offset & 0x03, data);
+}
+
+
+bool sega_sk1100_device::is_readable(UINT8 offset)
+{
+ return (m_keylatch != 0x07 ? true : false);
+}
+
+
+/*-------------------------------------------------
+ I8255 INTERFACE
+-------------------------------------------------*/
+
+READ8_MEMBER( sega_sk1100_device::ppi_pa_r )
+{
+ /*
+ Signal Description
+
+ PA0 Keyboard input
+ PA1 Keyboard input
+ PA2 Keyboard input
+ PA3 Keyboard input
+ PA4 Keyboard input
+ PA5 Keyboard input
+ PA6 Keyboard input
+ PA7 Keyboard input
+ */
+
+ return m_key_row[m_keylatch]->read();
+}
+
+READ8_MEMBER( sega_sk1100_device::ppi_pb_r )
+{
+ /*
+ Signal Description
+
+ PB0 Keyboard input
+ PB1 Keyboard input
+ PB2 Keyboard input
+ PB3 Keyboard input
+ PB4 /CONT input from cartridge terminal B-11
+ PB5 FAULT input from printer
+ PB6 BUSY input from printer
+ PB7 Cassette tape input
+ */
+
+ /* keyboard */
+ UINT8 data = m_key_row[m_keylatch + 8]->read();
+
+ /* cartridge contact */
+ data |= 0x10;
+
+ /* printer */
+ data |= 0x60;
+
+ /* tape input */
+ if (m_cassette->input() > +0.0) data |= 0x80;
+
+ return data;
+}
+
+WRITE8_MEMBER( sega_sk1100_device::ppi_pc_w )
+{
+ /*
+ Signal Description
+
+ PC0 Keyboard raster output
+ PC1 Keyboard raster output
+ PC2 Keyboard raster output
+ PC3 not connected
+ PC4 Cassette tape output
+ PC5 DATA to printer
+ PC6 /RESET to printer
+ PC7 /FEED to printer
+ */
+
+ /* keyboard */
+ m_keylatch = data & 0x07;
+
+ /* cassette */
+ m_cassette->output( BIT(data, 4) ? +1.0 : -1.0);
+
+ /* TODO printer */
+}
+
diff --git a/src/devices/bus/sg1000_exp/sk1100.h b/src/devices/bus/sg1000_exp/sk1100.h
new file mode 100644
index 00000000000..80cabb3f30d
--- /dev/null
+++ b/src/devices/bus/sg1000_exp/sk1100.h
@@ -0,0 +1,84 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Sega SK-1100 keyboard emulation
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SEGA_SK1100__
+#define __SEGA_SK1100__
+
+
+#include "emu.h"
+#include "sg1000exp.h"
+#include "formats/sc3000_bit.h"
+#include "imagedev/cassette.h"
+#include "imagedev/printer.h"
+#include "machine/i8255.h"
+
+
+#define UPD9255_0_TAG "upd9255_0" // "upd9255_1" is being used by the SF-7000 driver
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> sega_sk1100_device
+
+class sega_sk1100_device : public device_t,
+ public device_sg1000_expansion_slot_interface
+{
+public:
+ // construction/destruction
+ sega_sk1100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const override;
+
+ DECLARE_READ8_MEMBER( ppi_pa_r );
+ DECLARE_READ8_MEMBER( ppi_pb_r );
+ DECLARE_WRITE8_MEMBER( ppi_pc_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+ // device_sg1000_expansion_slot_interface overrides
+ virtual DECLARE_READ8_MEMBER(peripheral_r) override;
+ virtual DECLARE_WRITE8_MEMBER(peripheral_w) override;
+ virtual bool is_readable(UINT8 offset) override;
+
+private:
+ ioport_port* m_key_row[16];
+ required_device m_cassette;
+ required_device m_ppi;
+ required_ioport m_pa0;
+ required_ioport m_pa1;
+ required_ioport m_pa2;
+ required_ioport m_pa3;
+ required_ioport m_pa4;
+ required_ioport m_pa5;
+ required_ioport m_pa6;
+ required_ioport m_pb0;
+ required_ioport m_pb1;
+ required_ioport m_pb2;
+ required_ioport m_pb3;
+ required_ioport m_pb4;
+ required_ioport m_pb5;
+ required_ioport m_pb6;
+
+ /* keyboard state */
+ UINT8 m_keylatch;
+};
+
+
+// device type definition
+extern const device_type SEGA_SK1100;
+
+
+#endif
diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp
index 5db830866ee..86b79d91d04 100644
--- a/src/devices/cpu/t11/t11.cpp
+++ b/src/devices/cpu/t11/t11.cpp
@@ -191,38 +191,41 @@ static const struct irq_table_entry irq_table[] =
{ 7<<5, 0x60 }
};
-void t11_device::t11_check_irqs()
+void t11_device::t11_check_irqs(int prio)
{
- const struct irq_table_entry *irq = &irq_table[m_irq_state & 15];
- int priority = PSW & 0xe0;
+ int i, priority = PSW & 0xe0;
- /* compare the priority of the interrupt to the PSW */
- if (irq->priority > priority)
+ for(i = prio; i < 16; i++)
{
- int vector = irq->vector;
- int new_pc, new_psw;
-
- /* call the callback; if we don't get -1 back, use the return value as our vector */
- int new_vector = standard_irq_callback(m_irq_state & 15);
- if (new_vector != -1)
- vector = new_vector;
-
- /* fetch the new PC and PSW from that vector */
- assert((vector & 3) == 0);
- new_pc = RWORD(vector);
- new_psw = RWORD(vector + 2);
-
- /* push the old state, set the new one */
- PUSH(PSW);
- PUSH(PC);
- PCD = new_pc;
- PSW = new_psw;
- t11_check_irqs();
-
- /* count cycles and clear the WAIT flag */
- m_icount -= 114;
- m_wait_state = 0;
+ if(((m_irq_state >> i) & 1) && (irq_table[i].priority > priority))
+ break;
}
+ if(i >= 16)
+ return;
+
+ int vector = irq_table[i].vector;
+ int new_pc, new_psw;
+
+ /* call the callback; if we don't get -1 back, use the return value as our vector */
+ int new_vector = standard_irq_callback(i);
+ if (new_vector != -1)
+ vector = new_vector;
+
+ /* fetch the new PC and PSW from that vector */
+ assert((vector & 3) == 0);
+ new_pc = RWORD(vector);
+ new_psw = RWORD(vector + 2);
+
+ /* push the old state, set the new one */
+ PUSH(PSW);
+ PUSH(PC);
+ PCD = new_pc;
+ PSW = new_psw;
+ t11_check_irqs(i + 1);
+
+ /* count cycles and clear the WAIT flag */
+ m_icount -= 114;
+ m_wait_state = 0;
}
diff --git a/src/devices/cpu/t11/t11.h b/src/devices/cpu/t11/t11.h
index 55d11c9666a..9cb7c80970f 100644
--- a/src/devices/cpu/t11/t11.h
+++ b/src/devices/cpu/t11/t11.h
@@ -76,7 +76,7 @@ protected:
PAIR m_psw;
UINT16 m_initial_pc;
UINT8 m_wait_state;
- UINT8 m_irq_state;
+ UINT16 m_irq_state;
int m_icount;
address_space *m_program;
direct_read_data *m_direct;
@@ -88,7 +88,7 @@ protected:
inline void WWORD(int addr, int data);
inline void PUSH(int val);
inline int POP();
- void t11_check_irqs();
+ void t11_check_irqs(int prio = 0);
typedef void ( t11_device::*opcode_func )(UINT16 op);
static const opcode_func s_opcode_table[65536 >> 3];
diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp
index 399f48e9b26..09e5e6cf1d6 100644
--- a/src/devices/video/315_5124.cpp
+++ b/src/devices/video/315_5124.cpp
@@ -45,7 +45,7 @@ A scanline contains the following sections:
NTSC frame timing
256x192 256x224 256x240 (doesn't work on real hardware)
- - vertical blanking 3 D5-D7 3 E5-E7 3 ED-EF
+ - vertical sync 3 D5-D7 3 E5-E7 3 ED-EF
- top blanking 13 D8-E4 13 E8-F4 13 F0-FC
- top border 27 E5-FF 11 F5-FF 3 FD-FF
- active display 192 00-BF 224 00-DF 240 00-EF
@@ -55,7 +55,7 @@ NTSC frame timing
PAL frame timing
256x192 256x224 256x240
- - vertical blanking 3 BA-BC 3 CA-CC 3 D2-D4
+ - vertical sync 3 BA-BC 3 CA-CC 3 D2-D4
- top blanking 13 BD-C9 13 CD-D9 13 D5-E1
- top border 54 CA-FF 38 DA-FF 30 E2-FF
- active display 192 00-BF 224 00-DF 240 00-EF
@@ -90,7 +90,7 @@ PAL frame timing
#define PRIORITY_BIT 0x1000
#define BACKDROP_COLOR ((m_vdp_mode == 4 ? 0x10 : 0x00) + (m_reg[0x07] & 0x0f))
-#define VERTICAL_BLANKING 0
+#define VERTICAL_SYNC 0
#define TOP_BLANKING 1
#define TOP_BORDER 2
#define ACTIVE_DISPLAY_V 3
@@ -169,6 +169,7 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const ch
, m_supports_224_240( false )
, m_is_pal(false)
, m_int_cb(*this)
+ , m_csync_cb(*this)
, m_pause_cb(*this)
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(sega315_5124))
, m_palette(*this, "palette")
@@ -185,6 +186,7 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_t
, m_supports_224_240( supports_224_240 )
, m_is_pal(false)
, m_int_cb(*this)
+ , m_csync_cb(*this)
, m_pause_cb(*this)
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(sega315_5124))
, m_palette(*this, "palette")
@@ -289,7 +291,7 @@ void sega315_5124_device::set_frame_timing()
READ8_MEMBER( sega315_5124_device::vcount_read )
{
- const int active_scr_start = m_frame_timing[VERTICAL_BLANKING] + m_frame_timing[TOP_BLANKING] + m_frame_timing[TOP_BORDER];
+ const int active_scr_start = m_frame_timing[VERTICAL_SYNC] + m_frame_timing[TOP_BLANKING] + m_frame_timing[TOP_BORDER];
int vpos = m_screen->vpos();
if (m_screen->hpos() < VCOUNT_CHANGE_HPOS)
@@ -415,7 +417,7 @@ void sega315_5124_device::device_timer(emu_timer &timer, device_timer_id id, int
void sega315_5124_device::process_line_timer()
{
const int vpos = m_screen->vpos();
- int vpos_limit = m_frame_timing[VERTICAL_BLANKING] + m_frame_timing[TOP_BLANKING]
+ int vpos_limit = m_frame_timing[VERTICAL_SYNC] + m_frame_timing[TOP_BLANKING]
+ m_frame_timing[TOP_BORDER] + m_frame_timing[ACTIVE_DISPLAY_V]
+ m_frame_timing[BOTTOM_BORDER] + m_frame_timing[BOTTOM_BLANKING];
@@ -423,6 +425,22 @@ void sega315_5124_device::process_line_timer()
m_display_disabled = !(m_reg[0x01] & 0x40);
m_reg8copy = m_reg[0x08];
+ /* Check if the /CSYNC signal must be active (low) */
+ if ( !m_csync_cb.isnull() )
+ {
+ /* /CSYNC is signals /HSYNC and /VSYNC (both internals) ANDed together.
+ According to Charles MacDonald, /HSYNC goes low for 28 pixels on beginning
+ (before active screen) of all lines except on vertical sync area, where
+ /VSYNC goes low for 3 full lines, and except the two lines that follows,
+ because /VSYNC goes high for another line and remains high until the
+ active screen of the next line, what avoids a /HSYNC pulse there.
+ */
+ if (vpos == 0 || vpos > (m_frame_timing[VERTICAL_SYNC] + 1))
+ {
+ m_csync_cb(0);
+ }
+ }
+
vpos_limit -= m_frame_timing[BOTTOM_BLANKING];
/* Check if we're below the bottom border */
@@ -529,7 +547,7 @@ void sega315_5124_device::process_line_timer()
return;
}
- /* we're in the vertical or top blanking area */
+ /* we're in the vertical sync or top blanking areas */
m_line_counter = m_reg[0x0a];
}
@@ -1575,6 +1593,7 @@ void sega315_5124_device::device_start()
{
/* Resolve callbacks */
m_int_cb.resolve();
+ m_csync_cb.resolve();
m_pause_cb.resolve();
/* Allocate video RAM */
diff --git a/src/devices/video/315_5124.h b/src/devices/video/315_5124.h
index 9c2f2484209..d34d54d91d0 100644
--- a/src/devices/video/315_5124.h
+++ b/src/devices/video/315_5124.h
@@ -68,6 +68,7 @@ public:
template static devcb_base &set_int_callback(device_t &device, _Object object) { return downcast(device).m_int_cb.set_callback(object); }
+ template static devcb_base &set_csync_callback(device_t &device, _Object object) { return downcast(device).m_csync_cb.set_callback(object); }
template static devcb_base &set_pause_callback(device_t &device, _Object object) { return downcast(device).m_pause_cb.set_callback(object); }
DECLARE_READ8_MEMBER( vram_read );
@@ -156,6 +157,7 @@ protected:
int m_current_palette[32];
bool m_is_pal; /* false = NTSC, true = PAL */
devcb_write_line m_int_cb; /* Interrupt callback function */
+ devcb_write_line m_csync_cb; /* C-Sync callback function */
devcb_write_line m_pause_cb; /* Pause callback function */
emu_timer *m_display_timer;
emu_timer *m_hint_timer;
@@ -224,6 +226,9 @@ protected:
#define MCFG_SEGA315_5124_INT_CB(_devcb) \
devcb = &sega315_5124_device::set_int_callback(*device, DEVCB_##_devcb);
+#define MCFG_SEGA315_5124_CSYNC_CB(_devcb) \
+ devcb = &sega315_5124_device::set_csync_callback(*device, DEVCB_##_devcb);
+
#define MCFG_SEGA315_5124_PAUSE_CB(_devcb) \
devcb = &sega315_5124_device::set_pause_callback(*device, DEVCB_##_devcb);
@@ -236,6 +241,9 @@ protected:
#define MCFG_SEGA315_5246_INT_CB(_devcb) \
devcb = &sega315_5246_device::set_int_callback(*device, DEVCB_##_devcb);
+#define MCFG_SEGA315_5246_CSYNC_CB(_devcb) \
+ devcb = &sega315_5246_device::set_csync_callback(*device, DEVCB_##_devcb);
+
#define MCFG_SEGA315_5246_PAUSE_CB(_devcb) \
devcb = &sega315_5246_device::set_pause_callback(*device, DEVCB_##_devcb);
@@ -248,6 +256,9 @@ protected:
#define MCFG_SEGA315_5378_INT_CB(_devcb) \
devcb = &sega315_5378_device::set_int_callback(*device, DEVCB_##_devcb);
+#define MCFG_SEGA315_5378_CSYNC_CB(_devcb) \
+ devcb = &sega315_5378_device::set_csync_callback(*device, DEVCB_##_devcb);
+
#define MCFG_SEGA315_5378_PAUSE_CB(_devcb) \
devcb = &sega315_5378_device::set_pause_callback(*device, DEVCB_##_devcb);
diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp
index 7a416b0704d..8e55b8ac86f 100644
--- a/src/frontend/mame/ui/viewgfx.cpp
+++ b/src/frontend/mame/ui/viewgfx.cpp
@@ -1097,6 +1097,14 @@ static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, i
state.bitmap_dirty = true;
}
+ // return to (0,0) (HOME)
+ if( machine.ui_input().pressed(IPT_UI_HOME))
+ {
+ state.tilemap.xoffs = 0;
+ state.tilemap.yoffs = 0;
+ state.bitmap_dirty = true;
+ }
+
// handle navigation (up,down,left,right)
step = 8;
if (machine.input().code_pressed(KEYCODE_LSHIFT)) step = 1;
diff --git a/src/lib/util/strformat.h b/src/lib/util/strformat.h
index 975f3f39de5..7fb41c1d52b 100644
--- a/src/lib/util/strformat.h
+++ b/src/lib/util/strformat.h
@@ -168,8 +168,8 @@
#pragma once
-#ifndef __MAME_UTIL_STRFORMAT_H__
-#define __MAME_UTIL_STRFORMAT_H__
+#ifndef MAME_UTIL_STRFORMAT_H
+#define MAME_UTIL_STRFORMAT_H
#include
#include
@@ -185,18 +185,18 @@
#include
#include
-#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20150413)
-namespace std
-{
-template
- inline constexpr auto
- cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont)))-> decltype(std::begin(__cont))
- { return std::begin(__cont); }
+#if defined(__GLIBCXX__)
+namespace std {
+namespace mame_cxx14_compat {
+template
+inline constexpr auto cbegin(const T& cont) noexcept(noexcept(std::begin(cont))) -> decltype(std::begin(cont))
+{ return std::begin(cont); }
-template
- inline constexpr auto
- cend(const _Container& __cont) noexcept(noexcept(std::end(__cont)))-> decltype(std::end(__cont))
- { return std::end(__cont); }
+template
+inline constexpr auto cend(const T& cont) noexcept(noexcept(std::end(cont))) -> decltype(std::end(cont))
+{ return std::end(cont); }
+}
+using namespace mame_cxx14_compat;
}
#endif
@@ -1746,4 +1746,4 @@ using detail::make_format_argument_pack;
using util::string_format;
-#endif // __MAME_UTIL_STRFORMAT_H__
+#endif // MAME_UTIL_STRFORMAT_H
diff --git a/src/lib/util/vecstream.h b/src/lib/util/vecstream.h
index 4491c1d61b7..aaf0e84e61b 100644
--- a/src/lib/util/vecstream.h
+++ b/src/lib/util/vecstream.h
@@ -14,8 +14,8 @@
***************************************************************************/
-#ifndef __MAME_UTIL_VECSTREAM_H__
-#define __MAME_UTIL_VECSTREAM_H__
+#ifndef MAME_UTIL_VECSTREAM_H
+#define MAME_UTIL_VECSTREAM_H
#include
#include
@@ -395,4 +395,4 @@ void swap(basic_vectorstream &a, basic_vectorstreamset_input_line(3, ASSERT_LINE);
+ m_maincpu->set_input_line(8, ASSERT_LINE);
else
- m_maincpu->set_input_line(3, CLEAR_LINE);
+ m_maincpu->set_input_line(8, CLEAR_LINE);
if (m_scanline_int_state)
+ m_maincpu->set_input_line(4, ASSERT_LINE);
+ else
+ m_maincpu->set_input_line(4, CLEAR_LINE);
+
+ if (m_p2portwr_state)
m_maincpu->set_input_line(2, ASSERT_LINE);
else
m_maincpu->set_input_line(2, CLEAR_LINE);
- if (m_p2portwr_state)
+ if (m_p2portrd_state)
m_maincpu->set_input_line(1, ASSERT_LINE);
else
m_maincpu->set_input_line(1, CLEAR_LINE);
-
- if (m_p2portrd_state)
- m_maincpu->set_input_line(0, ASSERT_LINE);
- else
- m_maincpu->set_input_line(0, CLEAR_LINE);
}
diff --git a/src/mame/drivers/galgame.cpp b/src/mame/drivers/galgame.cpp
index 07c9b348eec..f8bb996747a 100644
--- a/src/mame/drivers/galgame.cpp
+++ b/src/mame/drivers/galgame.cpp
@@ -296,7 +296,7 @@ ADDRESS_MAP_END
IRQ_CALLBACK_MEMBER(galaxygame_state::galaxygame_irq_callback)
{
- device.execute().set_input_line(0, CLEAR_LINE);
+ device.execute().set_input_line(1, CLEAR_LINE);
return 0x40;
}
@@ -304,7 +304,7 @@ INTERRUPT_GEN_MEMBER(galaxygame_state::galaxygame_irq)
{
if ( m_clk & 0x40 )
{
- device.execute().set_input_line(0, ASSERT_LINE);
+ device.execute().set_input_line(1, ASSERT_LINE);
m_interrupt = 1;
}
}
diff --git a/src/mame/drivers/homedata.cpp b/src/mame/drivers/homedata.cpp
index fdd5ee0029e..1259afcd209 100644
--- a/src/mame/drivers/homedata.cpp
+++ b/src/mame/drivers/homedata.cpp
@@ -9,7 +9,7 @@ driver by Phil Stroffolino and Nicola Salmoria
*1987 X77 Mahjong Hourouki Part1 -Seisyun Hen-
*1987 X72 Mahjong Hourouki Gaiden
- 1988 Mahjong Joshi Pro-wres -Give up 5 byou mae-
+*1988 X73 Mahjong Joshi Pro-wres -Give up 5 byou mae-
*1988 A74 Mahjong Hourouki Okite
*1988 X80 Mahjong Clinic
*1988 M81 Mahjong Rokumeikan
@@ -146,6 +146,18 @@ CPU: 6809 uPC324C
Sound: SN76489
OSC: 16.000MHz 9.000MHz
+----------------------------------------------------------------------------
+----------------------------------------------------------------------------
+Mahjong Joshi Pro-wres -Give up 5 byou mae-
+(c)1988 HOME DATA
+
+Board: X73-PWB-A(C)
+
+CPU: 6809 uPC324C
+Sound: SN76489
+OSC: 16.000MHz 9.000MHz
+ROM: 28 pin mask rom devices are 1mbit, 32 pin are 2mbit.
+
----------------------------------------------------------------------------
Mahjong Vitamin C
(c)1989 Home Data
@@ -957,6 +969,38 @@ static INPUT_PORTS_START( pteacher )
PORT_INCLUDE( mj_keyboard )
INPUT_PORTS_END
+static INPUT_PORTS_START( mjjoship )
+ PORT_INCLUDE( pteacher )
+
+ PORT_MODIFY("DSW")
+ // SW1
+ PORT_DIPNAME( 0x0001, 0x0000, "Attract Sound" ) PORT_DIPLOCATION("SW1:1")
+ PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0002, 0x0002, "SW1:2" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0004, 0x0004, "SW1:3" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0008, 0x0008, "SW1:4" )
+ PORT_DIPNAME( 0x0010, 0x0010, "Player Start Score" ) PORT_DIPLOCATION("SW1:5")
+ PORT_DIPSETTING( 0x0010, "1000" )
+ PORT_DIPSETTING( 0x0000, "2000" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "SW1:6" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" )
+ PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
+
+ // SW2
+ PORT_DIPUNKNOWN_DIPLOC( 0x0100, 0x0100, "SW2:1" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x1000, 0x1000, "SW2:5" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x2000, 0x2000, "SW2:6" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x4000, 0x4000, "SW2:7" )
+ PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW2:8" )
+
+INPUT_PORTS_END
+
static INPUT_PORTS_START( lemnangl )
PORT_INCLUDE( pteacher )
@@ -1779,6 +1823,39 @@ ROM_START( mjkojink )
ROM_LOAD( "x83b03.12e", 0x0000, 0x40000, CRC(4ba8b5ec) SHA1(cee77583f2f7b7fdba7e0f17e4d1244891488d36) )
ROM_END
+ROM_START( mjjoship )
+ ROM_REGION( 0x01c000, "maincpu", 0 ) /* 6809 Code */
+ ROM_LOAD( "X73_L01.16E", 0x010000, 0xc000, CRC(df950025) SHA1(3dc22c0a8cf03cff7310fbff36f83804019a5337) )
+ ROM_CONTINUE( 0x00c000, 0x4000 )
+
+ ROM_REGION( 0x40000, "audiocpu", 0) /* uPD7807 code */
+ ROM_LOAD( "X73_B02.9G", 0x00000, 0x20000, CRC(6b01503b) SHA1(2e1575dac0b9b7c7233a3b8262a99a10e24ec813) )
+ ROM_RELOAD( 0x20000, 0x20000 )
+
+ ROM_REGION( 0x80000, "gfx1", 0 )
+ ROM_LOAD32_BYTE( "X73A14.1F", 0, 0x20000, CRC(42f429a5) SHA1(41f64258a65b56f818f8a6ecddab606d0bdc11ab) )
+ ROM_LOAD32_BYTE( "X73A15.3F", 1, 0x20000, CRC(2d827236) SHA1(d392dc64f136fd2ef19a2874758ad7804741882a) )
+ ROM_IGNORE( 0x20000 )
+ ROM_LOAD32_BYTE( "X73A16.4F", 2, 0x20000, CRC(c606cd02) SHA1(d316f11ad56359c8ae74858a84b373dd06934888) )
+ ROM_IGNORE( 0x20000 )
+ ROM_LOAD32_BYTE( "X73A17.6F", 3, 0x20000, CRC(2c0fdbc9) SHA1(3ae5b590db4705deeaeff93680a10ca980e6264f) )
+ ROM_IGNORE( 0x20000 )
+
+ ROM_REGION( 0x100000, "gfx2", 0 )
+ ROM_LOAD32_BYTE( "X73A10.1C", 0, 0x40000, CRC(e6663a99) SHA1(361503c16e32977c8f6b9c5ff981002ac0f97426) )
+ ROM_LOAD32_BYTE( "X73A11.3C", 1, 0x40000, CRC(d8a35ebe) SHA1(b6e12db38ddd6dcefa8335b92c0a6e269a6a1e9a) )
+ ROM_LOAD32_BYTE( "X73A12.4C", 2, 0x40000, CRC(f3b6ad98) SHA1(d91eeffd18684300809c99fa93d4ac0188530ff7) )
+ ROM_LOAD32_BYTE( "X73A13.6C", 3, 0x40000, CRC(30ff8c5f) SHA1(e51d89f6b5db0d8e2c22a046337993f962f6ba8c) )
+
+ ROM_REGION( 0x010000, "proms", 0 ) /* static palette */
+ ROM_LOAD16_BYTE( "X73_C19.4K", 0x00000, 0x8000, CRC(f4bdce8a) SHA1(e3168d6aa6f8cd24b497706a117c77353d1c6ef3) )
+ ROM_LOAD16_BYTE( "X73_C18.3K", 0x00001, 0x8000, CRC(1ab265cc) SHA1(24dced438a28ea9eb2f06c8859c5c07f4d975bfd) )
+
+ ROM_REGION( 0x20000, "user1", 0 ) /* blitter data */
+ ROM_LOAD( "X73A03.12E", 0x0000, 0x20000, CRC(fd32eb8c) SHA1(584afb1ed2da776a4ff9c0b9eb2906c914b28928) )
+ROM_END
+
+
ROM_START( vitaminc )
ROM_REGION( 0x01c000, "maincpu", 0 ) /* 6809 Code */
ROM_LOAD( "x90e01.bin", 0x010000, 0xc000, CRC(bc982525) SHA1(30f5e9ab27f799b895a3d979109e331603d94249) )
@@ -2041,6 +2118,7 @@ GAME( 1988, mrokumei, 0, mrokumei, mjhokite, driver_device, 0, ROT0, "
GAME( 1988, reikaids, 0, reikaids, reikaids, homedata_state, reikaids, ROT0, "Home Data", "Reikai Doushi (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1991, battlcry, 0, reikaids, battlcry, homedata_state, battlcry, ROT0, "Home Data", "Battlecry", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1989, mjkojink, 0, pteacher, pteacher, driver_device, 0, ROT0, "Home Data", "Mahjong Kojinkyouju (Private Teacher) (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, mjjoship, 0, pteacher, mjjoship, driver_device, 0, ROT0, "Home Data", "Mahjong Joshi Pro-wres -Give up 5 byou mae- (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1989, vitaminc, 0, pteacher, pteacher, driver_device, 0, ROT0, "Home Data", "Mahjong Vitamin C (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, mjyougo, 0, pteacher, pteacher, driver_device, 0, ROT0, "Home Data", "Mahjong-yougo no Kisotairyoku (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1991, mjkinjas, 0, mjkinjas, pteacher, driver_device, 0, ROT0, "Home Data", "Mahjong Kinjirareta Asobi (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/kinst.cpp b/src/mame/drivers/kinst.cpp
index 00786922e1c..c158bf95c05 100644
--- a/src/mame/drivers/kinst.cpp
+++ b/src/mame/drivers/kinst.cpp
@@ -437,12 +437,12 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( kinst )
PORT_START("P1")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
+ PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 High Attack - Quick")
+ PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 High Attack - Medium")
+ PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 High Attack - Fierce")
+ PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Low Attack - Quick")
+ PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Low Attack - Medium")
+ PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Low Attack - Fierce")
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
@@ -456,12 +456,12 @@ static INPUT_PORTS_START( kinst )
PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("P2")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
+ PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 High Attack - Quick")
+ PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 High Attack - Medium")
+ PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 High Attack - Fierce")
+ PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Low Attack - Quick")
+ PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Low Attack - Medium")
+ PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Low Attack - Fierce")
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
@@ -546,12 +546,12 @@ INPUT_PORTS_END
static INPUT_PORTS_START( kinst2 )
PORT_START("P1")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
+ PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 High Attack - Quick")
+ PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 High Attack - Medium")
+ PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 High Attack - Fierce")
+ PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Low Attack - Quick")
+ PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME("P1 Low Attack - Medium")
+ PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME("P1 Low Attack - Fierce")
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
@@ -565,12 +565,12 @@ static INPUT_PORTS_START( kinst2 )
PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("P2")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
+ PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 High Attack - Quick")
+ PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 High Attack - Medium")
+ PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 High Attack - Fierce")
+ PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Low Attack - Quick")
+ PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("P2 Low Attack - Medium")
+ PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("P2 Low Attack - Fierce")
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp
index b09e9b7c57b..7e972516973 100644
--- a/src/mame/drivers/model2.cpp
+++ b/src/mame/drivers/model2.cpp
@@ -1516,7 +1516,9 @@ static ADDRESS_MAP_START( model2_base_mem, AS_PROGRAM, 32, model2_state )
AM_RANGE(0x01800000, 0x01803fff) AM_READWRITE16(model2_palette_r,model2_palette_w,0xffffffff)
AM_RANGE(0x01810000, 0x0181bfff) AM_RAM AM_SHARE("colorxlat")
AM_RANGE(0x0181c000, 0x0181c003) AM_WRITE(model2_3d_zclip_w)
- AM_RANGE(0x01a10000, 0x01a1ffff) AM_READWRITE(network_r, network_w)
+ AM_RANGE(0x01a10000, 0x01a13fff) AM_DEVREADWRITE8("m2comm", m2comm_device, share_r, share_w, 0xffffffff)
+ AM_RANGE(0x01a14000, 0x01a14003) AM_DEVREADWRITE8("m2comm", m2comm_device, cn_r, cn_w, 0x000000ff)
+ AM_RANGE(0x01a14000, 0x01a14003) AM_DEVREADWRITE8("m2comm", m2comm_device, fg_r, fg_w, 0x00ff0000)
AM_RANGE(0x01d00000, 0x01d03fff) AM_RAM AM_SHARE("backup1") // Backup sram
AM_RANGE(0x02000000, 0x03ffffff) AM_ROM AM_REGION("user1", 0)
@@ -2238,6 +2240,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(model2_state::model2_interrupt)
if(m_intena & 1<<0)
m_maincpu->set_input_line(I960_IRQ0, ASSERT_LINE);
model2_check_irq_state();
+ if (m_m2comm != nullptr)
+ m_m2comm->check_vint_irq();
}
else if(scanline == 0)
{
@@ -2259,6 +2263,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(model2_state::model2c_interrupt)
if(m_intena & 1<<0)
m_maincpu->set_input_line(I960_IRQ0, ASSERT_LINE);
model2_check_irq_state();
+ if (m_m2comm != nullptr)
+ m_m2comm->check_vint_irq();
}
else if(scanline == 0) // 384
{
@@ -2427,6 +2433,8 @@ static MACHINE_CONFIG_START( model2o, model2_state )
MCFG_VIDEO_START_OVERRIDE(model2_state,model2)
MCFG_SEGAM1AUDIO_ADD("m1audio")
+
+ MCFG_M2COMM_ADD("m2comm")
MACHINE_CONFIG_END
/* 2A-CRX */
@@ -2478,6 +2486,8 @@ static MACHINE_CONFIG_START( model2a, model2_state )
MCFG_SCSP_IRQ_CB(WRITE8(model2_state,scsp_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
+
+ MCFG_M2COMM_ADD("m2comm")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( manxttdx, model2a ) /* Includes a Model 1 Sound board for additional sounds - Deluxe version only */
@@ -2593,6 +2603,8 @@ static MACHINE_CONFIG_START( model2b, model2_state )
MCFG_SCSP_IRQ_CB(WRITE8(model2_state,scsp_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
+
+ MCFG_M2COMM_ADD("m2comm")
MACHINE_CONFIG_END
@@ -2656,6 +2668,8 @@ static MACHINE_CONFIG_START( model2c, model2_state )
MCFG_SCSP_IRQ_CB(WRITE8(model2_state, scsp_irq))
MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
+
+ MCFG_M2COMM_ADD("m2comm")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( stcc, model2c )
@@ -5953,7 +5967,7 @@ DRIVER_INIT_MEMBER(model2_state,sgt24h)
{
// DRIVER_INIT_CALL(genprot);
- m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
+ //m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
ROM[0x56578/4] = 0x08000004;
@@ -5962,7 +5976,7 @@ DRIVER_INIT_MEMBER(model2_state,sgt24h)
DRIVER_INIT_MEMBER(model2_state,overrev)
{
- m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
+ //m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
}
diff --git a/src/mame/drivers/sg1000.cpp b/src/mame/drivers/sg1000.cpp
index 102084994d1..d83b0756b5e 100644
--- a/src/mame/drivers/sg1000.cpp
+++ b/src/mame/drivers/sg1000.cpp
@@ -58,7 +58,6 @@ Notes:
- SC-3000 return instruction referenced by R when reading ports 60-7f,e0-ff
- connect PSG /READY signal to Z80 WAIT
- accurate video timing
- - SP-400 serial printer
- SH-400 racing controller
- SF-7000 serial comms
@@ -91,13 +90,31 @@ WRITE8_MEMBER( sg1000_state::omv_w )
m_cart->write_cart(space, offset, data);
}
-/*-------------------------------------------------
- joysel_r -
--------------------------------------------------*/
-
-READ8_MEMBER( sg1000_state::joysel_r )
+READ8_MEMBER( sg1000_state::peripheral_r )
{
- return 0x80;
+ bool joy_ports_disabled = m_sgexpslot->is_readable(offset);
+
+ if (joy_ports_disabled)
+ {
+ return m_sgexpslot->read(space, offset);
+ }
+ else
+ {
+ if (offset & 0x01)
+ return m_pb7->read();
+ else
+ return m_pa7->read();
+ }
+}
+
+WRITE8_MEMBER( sg1000_state::peripheral_w )
+{
+ bool joy_ports_disabled = m_sgexpslot->is_writeable(offset);
+
+ if (joy_ports_disabled)
+ {
+ m_sgexpslot->write(space, offset, data);
+ }
}
/*-------------------------------------------------
@@ -118,10 +135,7 @@ static ADDRESS_MAP_START( sg1000_io_map, AS_IO, 8, sg1000_state )
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write)
AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
- AM_RANGE(0xdc, 0xdc) AM_READ_PORT("PA7")
- AM_RANGE(0xdd, 0xdd) AM_READ_PORT("PB7")
- AM_RANGE(0xde, 0xde) AM_READ(joysel_r) AM_WRITENOP
- AM_RANGE(0xdf, 0xdf) AM_NOP
+ AM_RANGE(0xdc, 0xdf) AM_READWRITE(peripheral_r, peripheral_w)
ADDRESS_MAP_END
/*-------------------------------------------------
@@ -168,7 +182,7 @@ static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state )
AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write)
AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
- AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write)
+ AM_RANGE(0xdc, 0xdf) AM_READWRITE(peripheral_r, peripheral_w)
ADDRESS_MAP_END
/* This is how the I/O ports are really mapped, but MAME does not support overlapping ranges
@@ -200,7 +214,7 @@ static ADDRESS_MAP_START( sf7000_io_map, AS_IO, 8, sf7000_state )
AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SN76489AN_TAG, sn76489a_device, write)
AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
- AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_0_TAG, i8255_device, read, write)
+ AM_RANGE(0xdc, 0xdf) AM_READWRITE(peripheral_r, peripheral_w)
AM_RANGE(0xe0, 0xe1) AM_DEVICE(UPD765_TAG, upd765a_device, map)
AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE(UPD9255_1_TAG, i8255_device, read, write)
AM_RANGE(0xe8, 0xe8) AM_DEVREADWRITE(UPD8251_TAG, i8251_device, data_r, data_w)
@@ -224,7 +238,7 @@ INPUT_CHANGED_MEMBER( sg1000_state::trigger_nmi )
INPUT_PORTS( sg1000 )
-------------------------------------------------*/
-static INPUT_PORTS_START( sg1000 )
+static INPUT_PORTS_START( sg1000_joy )
PORT_START("PA7")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
@@ -241,6 +255,10 @@ static INPUT_PORTS_START( sg1000 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( sg1000 )
+ PORT_INCLUDE( sg1000_joy )
PORT_START("NMI")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_P) PORT_CHANGED_MEMBER(DEVICE_SELF, sg1000_state, trigger_nmi, 0)
@@ -299,138 +317,17 @@ static INPUT_PORTS_START( omv )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
-/*-------------------------------------------------
- INPUT_PORTS( sk1100 )
--------------------------------------------------*/
-
-INPUT_PORTS_START( sk1100 )
- PORT_START("PA0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q')
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a')
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z')
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENG DIER'S") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT))
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k')
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i')
-
- PORT_START("PA1")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w')
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s')
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x')
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l')
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o')
-
- PORT_START("PA2")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e')
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d')
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c')
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+')
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p')
-
- PORT_START("PA3")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r')
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f')
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v')
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_SMALL_PI) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x03c0)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`')
-
- PORT_START("PA4")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t')
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g')
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b')
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}')
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{')
-
- PORT_START("PA5")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y')
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h')
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n')
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("PA6")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u')
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j')
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m')
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("PA7")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-
- PORT_START("PB0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
- PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("PB1")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
- PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("PB2")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
- PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("PB3")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
- PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("PB4")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('^')
- PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("PB5")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa5") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x00a5)
- PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNC") PORT_CODE(KEYCODE_TAB)
-
- PORT_START("PB6")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
-
- PORT_START("PB7")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
-
- PORT_START("NMI")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, sg1000_state, trigger_nmi, 0)
-INPUT_PORTS_END
-
/*-------------------------------------------------
INPUT_PORTS( sc3000 )
-------------------------------------------------*/
static INPUT_PORTS_START( sc3000 )
- PORT_INCLUDE( sk1100 )
+ PORT_INCLUDE( sg1000_joy )
+
+ // keyboard keys are added by the embedded sk1100 device
+
+ PORT_START("NMI")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, sg1000_state, trigger_nmi, 0)
INPUT_PORTS_END
/*-------------------------------------------------
@@ -438,7 +335,7 @@ INPUT_PORTS_END
-------------------------------------------------*/
static INPUT_PORTS_START( sf7000 )
- PORT_INCLUDE( sk1100 )
+ PORT_INCLUDE( sc3000 )
PORT_START("BAUD")
PORT_CONFNAME( 0x07, 0x05, "Baud rate")
@@ -458,82 +355,6 @@ INPUT_PORTS_END
I8255 INTERFACE
-------------------------------------------------*/
-READ8_MEMBER( sc3000_state::ppi_pa_r )
-{
- /*
- Signal Description
-
- PA0 Keyboard input
- PA1 Keyboard input
- PA2 Keyboard input
- PA3 Keyboard input
- PA4 Keyboard input
- PA5 Keyboard input
- PA6 Keyboard input
- PA7 Keyboard input
- */
-
- return m_key_row[m_keylatch]->read();
-}
-
-READ8_MEMBER( sc3000_state::ppi_pb_r )
-{
- /*
- Signal Description
-
- PB0 Keyboard input
- PB1 Keyboard input
- PB2 Keyboard input
- PB3 Keyboard input
- PB4 /CONT input from cartridge terminal B-11
- PB5 FAULT input from printer
- PB6 BUSY input from printer
- PB7 Cassette tape input
- */
-
- /* keyboard */
- UINT8 data = m_key_row[m_keylatch + 8]->read();
-
- /* cartridge contact */
- data |= 0x10;
-
- /* printer */
- data |= 0x60;
-
- /* tape input */
- if (m_cassette->input() > +0.0) data |= 0x80;
-
- return data;
-}
-
-WRITE8_MEMBER( sc3000_state::ppi_pc_w )
-{
- /*
- Signal Description
-
- PC0 Keyboard raster output
- PC1 Keyboard raster output
- PC2 Keyboard raster output
- PC3 not connected
- PC4 Cassette tape output
- PC5 DATA to printer
- PC6 /RESET to printer
- PC7 /FEED to printer
- */
-
- /* keyboard */
- m_keylatch = data & 0x07;
-
- /* cassette */
- m_cassette->output( BIT(data, 4) ? +1.0 : -1.0);
-
- /* TODO printer */
-}
-
-/*-------------------------------------------------
- I8255 INTERFACE
--------------------------------------------------*/
-
WRITE_LINE_MEMBER( sf7000_state::write_centronics_busy )
{
m_centronics_busy = state;
@@ -643,27 +464,6 @@ void sc3000_state::machine_start()
/* toggle light gun crosshair */
timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
- // find keyboard rows
- m_key_row[0] = m_pa0;
- m_key_row[1] = m_pa1;
- m_key_row[2] = m_pa2;
- m_key_row[3] = m_pa3;
- m_key_row[4] = m_pa4;
- m_key_row[5] = m_pa5;
- m_key_row[6] = m_pa6;
- m_key_row[7] = m_pa7;
- m_key_row[8] = m_pb0;
- m_key_row[9] = m_pb1;
- m_key_row[10] = m_pb2;
- m_key_row[11] = m_pb3;
- m_key_row[12] = m_pb4;
- m_key_row[13] = m_pb5;
- m_key_row[14] = m_pb6;
- m_key_row[15] = m_pb7;
-
- /* register for state saving */
- save_item(NAME(m_keylatch));
-
if (m_cart && m_cart->exists() && (m_cart->get_type() == SEGA8_BASIC_L3 || m_cart->get_type() == SEGA8_MUSIC_EDITOR
|| m_cart->get_type() == SEGA8_DAHJEE_TYPEA || m_cart->get_type() == SEGA8_DAHJEE_TYPEB))
{
@@ -725,6 +525,9 @@ static MACHINE_CONFIG_START( sg1000, sg1000_state )
MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+ /* expansion slot */
+ MCFG_SG1000_EXPANSION_ADD(EXPSLOT_TAG, sg1000_expansion_devices, nullptr, false)
+
/* cartridge */
MCFG_SG1000_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, nullptr)
@@ -775,26 +578,15 @@ static MACHINE_CONFIG_START( sc3000, sc3000_state )
MCFG_SOUND_ADD(SN76489AN_TAG, SN76489A, XTAL_10_738635MHz/3)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
- /* devices */
- MCFG_DEVICE_ADD(UPD9255_TAG, I8255, 0)
- MCFG_I8255_IN_PORTA_CB(READ8(sc3000_state, ppi_pa_r))
- MCFG_I8255_IN_PORTB_CB(READ8(sc3000_state, ppi_pb_r))
- MCFG_I8255_OUT_PORTC_CB(WRITE8(sc3000_state, ppi_pc_w))
-
-// MCFG_PRINTER_ADD("sp400") /* serial printer */
-
- MCFG_CASSETTE_ADD("cassette")
- MCFG_CASSETTE_FORMATS(sc3000_cassette_formats)
- MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
- MCFG_CASSETTE_INTERFACE("sc3000_cass")
+ /* sc3000 has all sk1100 features built-in, so add it as a fixed slot */
+ MCFG_SG1000_EXPANSION_ADD(EXPSLOT_TAG, sg1000_expansion_devices, "sk1100", true)
/* cartridge */
MCFG_SC3000_CARTRIDGE_ADD(CARTSLOT_TAG, sg1000_cart, nullptr)
/* software lists */
MCFG_SOFTWARE_LIST_ADD("cart_list","sg1000")
- MCFG_SOFTWARE_LIST_ADD("sc3k_cart_list","sc3000_cart")
- MCFG_SOFTWARE_LIST_ADD("cass_list","sc3000_cass")
+ /* the sk1100 device will add sc3000 cart and cass lists */
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
@@ -825,11 +617,6 @@ static MACHINE_CONFIG_START( sf7000, sf7000_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
/* devices */
- MCFG_DEVICE_ADD(UPD9255_0_TAG, I8255, 0)
- MCFG_I8255_IN_PORTA_CB(READ8(sc3000_state, ppi_pa_r))
- MCFG_I8255_IN_PORTB_CB(READ8(sc3000_state, ppi_pb_r))
- MCFG_I8255_OUT_PORTC_CB(WRITE8(sc3000_state, ppi_pc_w))
-
MCFG_DEVICE_ADD(UPD9255_1_TAG, I8255, 0)
MCFG_I8255_IN_PORTA_CB(READ8(sf7000_state, ppi_pa_r))
MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_data_out", output_latch_device, write))
@@ -851,10 +638,8 @@ static MACHINE_CONFIG_START( sf7000, sf7000_state )
MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
- MCFG_CASSETTE_ADD("cassette")
- MCFG_CASSETTE_FORMATS(sc3000_cassette_formats)
- MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
- MCFG_CASSETTE_INTERFACE("sc3000_cass")
+ /* sf7000 (sc3000) has all sk1100 features built-in, so add it as a fixed slot */
+ MCFG_SG1000_EXPANSION_ADD(EXPSLOT_TAG, sg1000_expansion_devices, "sk1100", true)
/* software lists */
MCFG_SOFTWARE_LIST_ADD("flop_list","sf7000")
diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp
index 8f6480c28e7..1e88d602063 100644
--- a/src/mame/drivers/sms.cpp
+++ b/src/mame/drivers/sms.cpp
@@ -17,12 +17,9 @@
- SIO interface for Game Gear (needs netplay, I guess)
- Support for other DE-9 compatible controllers, like the Mega Drive 6-Button
that has homebrew software support
- - Sega SK-1100 keyboard support for Sega Mark III (sg1000m3 driver)
- Link between two Mark III's through keyboard, supported by F-16 Fighting Falcon
- - Mark III expansion slot, used by keyboard and FM Sound Unit
- - Rapid button of smsj, sms1krfm and sms1kr consoles
+ - On sms1kr (without FM), verify if Rapid uses C-Sync and PSG can be muted like on smsj
- Accurate GG vertical scaling in SMS mode (h-scaling seems right for subpixel rendering)
- - SMS drivers for other versions (one has a 10.746168MHz XTAL)
- Software compatibility flags, by region and/or BIOS
- Samsung modem for Gam*Boy Securities Information Service System
- Sega Demo Unit II (SMS kiosk-like expansion device)
@@ -256,8 +253,15 @@ DC00 - Selection buttons #2, 9-16 (R)
#include "sms1.lh"
-#define MASTER_CLOCK_PAL 53203425 /* 12 * subcarrier freq. (4.43361875MHz) */
#define MASTER_CLOCK_GG 32215905
+#define MASTER_CLOCK_PALN 10746168
+// The clocks for PAL and PAL-M used here differ from their nominal values,
+// because with the latter errors will occur on Flubba's VDPTest, probably
+// due to rounding issues in the core.
+// Nominal XTAL value for SMS PAL-M (Brazil) is 10726834.
+#define MASTER_CLOCK_PALM 10726833
+// Nominal XTAL value for SMS PAL is 53203424.
+#define MASTER_CLOCK_PAL 53203425 /* 12 * subcarrier freq. (4.43361875MHz) */
static ADDRESS_MAP_START( sms1_mem, AS_PROGRAM, 8, sms_state )
@@ -296,35 +300,57 @@ static ADDRESS_MAP_START( sg1000m3_io, AS_IO, 8, sms_state )
AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, sms_psg_w)
AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write)
AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write)
- AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1e) AM_READ(sms_input_port_dc_r)
- AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x1e) AM_READ(sms_input_port_dd_r)
- AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0e) AM_READ(sms_input_port_dc_r)
- AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x0e) AM_READ(sms_input_port_dd_r)
- AM_RANGE(0xf0, 0xf0) AM_READWRITE(sms_input_port_dc_r, sms_ym2413_register_port_w)
- AM_RANGE(0xf1, 0xf1) AM_READWRITE(sms_input_port_dd_r, sms_ym2413_data_port_w)
- AM_RANGE(0xf2, 0xf2) AM_READWRITE(sms_audio_control_r, sms_audio_control_w)
- AM_RANGE(0xf3, 0xf3) AM_READ(sms_input_port_dd_r)
- AM_RANGE(0xf4, 0xf4) AM_MIRROR(0x02) AM_READ(sms_input_port_dc_r)
- AM_RANGE(0xf5, 0xf5) AM_MIRROR(0x02) AM_READ(sms_input_port_dd_r)
- AM_RANGE(0xf8, 0xf8) AM_MIRROR(0x06) AM_READ(sms_input_port_dc_r)
- AM_RANGE(0xf9, 0xf9) AM_MIRROR(0x06) AM_READ(sms_input_port_dd_r)
+ AM_RANGE(0xc0, 0xc7) AM_MIRROR(0x38) AM_READWRITE(sg1000m3_peripheral_r,sg1000m3_peripheral_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sms_io, AS_IO, 8, sms_state )
- AM_IMPORT_FROM(sg1000m3_io)
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+ ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_mem_control_w)
AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(sms_io_control_w)
+ AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, sms_psg_w)
+ AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write)
+ AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write)
+ AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3e) AM_READ(sms_input_port_dc_r)
+ AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x3e) AM_READ(sms_input_port_dd_r)
+ADDRESS_MAP_END
+
+
+// It seems the Korean versions do some more strict decoding on the I/O
+// addresses.
+// At least the mirrors for I/O ports $3E/$3F don't seem to exist there.
+// Leaving the mirrors breaks the Korean cartridge bublboky.
+static ADDRESS_MAP_START( smskr_io, AS_IO, 8, sms_state )
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+ ADDRESS_MAP_UNMAP_HIGH
+ AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w)
+ AM_RANGE(0x3f, 0x3f) AM_WRITE(sms_io_control_w)
+ AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, sms_psg_w)
+ AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write)
+ AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write)
+ AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3e) AM_READ(sms_input_port_dc_r)
+ AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x3e) AM_READ(sms_input_port_dd_r)
ADDRESS_MAP_END
// Mirrors for I/O ports $3E/$3F don't exist on the Japanese SMS.
-// It seems the Korean versions do the same decoding on those I/O addresses.
-// Leaving the mirrors breaks the Korean cartridge bublboky.
+// Also, $C0/$C1 are the only mirrors for I/O ports $DC/$DD.
static ADDRESS_MAP_START( smsj_io, AS_IO, 8, sms_state )
- AM_IMPORT_FROM(sg1000m3_io)
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+ ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x3e, 0x3e) AM_WRITE(sms_mem_control_w)
AM_RANGE(0x3f, 0x3f) AM_WRITE(sms_io_control_w)
+ AM_RANGE(0x40, 0x7f) AM_READWRITE(sms_count_r, sms_psg_w)
+ AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, vram_read, vram_write)
+ AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sega315_5124_device, register_read, register_write)
+ AM_RANGE(0xc0, 0xc0) AM_READ(sms_input_port_dc_r)
+ AM_RANGE(0xc1, 0xc1) AM_READ(sms_input_port_dd_r)
+ AM_RANGE(0xdc, 0xdc) AM_READ(sms_input_port_dc_r)
+ AM_RANGE(0xdd, 0xdd) AM_READ(sms_input_port_dd_r)
+ AM_RANGE(0xf0, 0xf0) AM_WRITE(smsj_ym2413_register_port_w)
+ AM_RANGE(0xf1, 0xf1) AM_WRITE(smsj_ym2413_data_port_w)
+ AM_RANGE(0xf2, 0xf2) AM_READWRITE(smsj_audio_control_r, smsj_audio_control_w)
ADDRESS_MAP_END
@@ -381,8 +407,8 @@ INPUT_PORTS_END
static INPUT_PORTS_START( smsj )
PORT_INCLUDE( sg1000m3 )
- //PORT_START("RAPID")
- //PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Rapid Button") /* Not implemented */
+ PORT_START("RAPID")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Rapid Button")
INPUT_PORTS_END
static INPUT_PORTS_START( smssdisp )
@@ -460,23 +486,13 @@ static INPUT_PORTS_START( gg )
INPUT_PORTS_END
-static MACHINE_CONFIG_START( sms_ntsc_base, sms_state )
- /* basic machine hardware */
- MCFG_CPU_ADD("maincpu", Z80, XTAL_10_738635MHz/3)
- MCFG_CPU_PROGRAM_MAP(sms_mem)
- MCFG_CPU_IO_MAP(sms_io)
-
- MCFG_QUANTUM_TIME(attotime::from_hz(60))
-
+static MACHINE_CONFIG_START( sms_base, sms_state )
MCFG_MACHINE_START_OVERRIDE(sms_state,sms)
MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms)
- /* sound hardware */
+ /* basic machine hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("segapsg", SEGAPSG, XTAL_10_738635MHz/3)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
-
MCFG_SMS_CARTRIDGE_ADD("slot", sms_cart, nullptr)
MCFG_SOFTWARE_LIST_ADD("cart_list","sms")
@@ -490,6 +506,18 @@ static MACHINE_CONFIG_START( sms_ntsc_base, sms_state )
MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color))
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( sms_ntsc_base, sms_base )
+ MCFG_CPU_ADD("maincpu", Z80, XTAL_10_738635MHz/3)
+ MCFG_CPU_PROGRAM_MAP(sms_mem)
+ MCFG_CPU_IO_MAP(sms_io)
+
+ MCFG_QUANTUM_TIME(attotime::from_hz(60))
+
+ /* actually, PSG is embedded in the VDP chip */
+ MCFG_SOUND_ADD("segapsg", SEGAPSG, XTAL_10_738635MHz/3)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+MACHINE_CONFIG_END
+
/*
For SMS drivers, the ratio between CPU and pixel clocks, set through dividers, is 2/3. The
division that sets the pixel clock, in MCFG_SCREEN_RAW_PARAMS(), results in a remainder
@@ -507,13 +535,41 @@ MACHINE_CONFIG_END
lines after each MCFG_SCREEN_RAW_PARAMS call below can be removed.
*/
+#define MCFG_SCREEN_SMS_PAL_RAW_PARAMS(_pixelclock) \
+ MCFG_SCREEN_RAW_PARAMS(_pixelclock, \
+ SEGA315_5124_WIDTH, \
+ SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, \
+ SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
+ SEGA315_5124_HEIGHT_PAL, \
+ SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, \
+ SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240) \
+ MCFG_SCREEN_REFRESH_RATE((double) _pixelclock / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL))
+
+#define MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(_pixelclock) \
+ MCFG_SCREEN_RAW_PARAMS(_pixelclock, \
+ SEGA315_5124_WIDTH, \
+ SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, \
+ SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
+ SEGA315_5124_HEIGHT_NTSC, \
+ SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, \
+ SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224) \
+ MCFG_SCREEN_REFRESH_RATE((double) _pixelclock / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC))
+
+#define MCFG_SCREEN_GG_RAW_PARAMS(_pixelclock) \
+ MCFG_SCREEN_RAW_PARAMS(_pixelclock, \
+ SEGA315_5124_WIDTH, \
+ SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 6*8, \
+ SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 26*8, \
+ SEGA315_5124_HEIGHT_NTSC, \
+ SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 3*8, \
+ SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 21*8 ) \
+ MCFG_SCREEN_REFRESH_RATE((double) _pixelclock / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC))
+
+
static MACHINE_CONFIG_DERIVED( sms2_ntsc, sms_ntsc_base )
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_RAW_PARAMS(XTAL_10_738635MHz/2, \
- SEGA315_5124_WIDTH , SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224)
- MCFG_SCREEN_REFRESH_RATE((double) XTAL_10_738635MHz/2 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC))
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(XTAL_10_738635MHz/2)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
@@ -528,28 +584,18 @@ static MACHINE_CONFIG_DERIVED( sms1_ntsc, sms_ntsc_base )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
- MCFG_CPU_IO_MAP(sms_io)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_RAW_PARAMS(XTAL_10_738635MHz/2, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224)
- MCFG_SCREEN_REFRESH_RATE((double) XTAL_10_738635MHz/2 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC))
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(XTAL_10_738635MHz/2)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD
- MCFG_SCREEN_RAW_PARAMS(XTAL_10_738635MHz/2, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224)
- MCFG_SCREEN_REFRESH_RATE((double) XTAL_10_738635MHz/2 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC))
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(XTAL_10_738635MHz/2)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD
- MCFG_SCREEN_RAW_PARAMS(XTAL_10_738635MHz/2, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224)
- MCFG_SCREEN_REFRESH_RATE((double) XTAL_10_738635MHz/2 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC))
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(XTAL_10_738635MHz/2)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1)
@@ -567,7 +613,7 @@ static MACHINE_CONFIG_DERIVED( sms1_ntsc, sms_ntsc_base )
// card and expansion slots, not present in Master System II
MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SMS_EXPANSION_ADD("exp", sms_expansion_devices, nullptr)
+ MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED_CLASS( sms_sdisp, sms1_ntsc, smssdisp_state )
@@ -581,7 +627,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( sms_sdisp, sms1_ntsc, smssdisp_state )
MCFG_CPU_IO_MAP(sms_io)
MCFG_DEVICE_REMOVE("mycard")
- MCFG_DEVICE_REMOVE("exp")
+ MCFG_DEVICE_REMOVE("smsexp")
MCFG_SMS_CARTRIDGE_ADD("slot2", sms_cart, nullptr)
MCFG_SMS_CARTRIDGE_ADD("slot3", sms_cart, nullptr)
@@ -617,7 +663,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( sms_sdisp, sms1_ntsc, smssdisp_state )
MCFG_SMS_CARD_ADD("slot32", sms_cart, nullptr)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( sms_pal_base, sms_state )
+static MACHINE_CONFIG_DERIVED( sms_pal_base, sms_base )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_PAL/15)
MCFG_CPU_PROGRAM_MAP(sms_mem)
@@ -625,36 +671,16 @@ static MACHINE_CONFIG_START( sms_pal_base, sms_state )
MCFG_QUANTUM_TIME(attotime::from_hz(50))
- MCFG_MACHINE_START_OVERRIDE(sms_state,sms)
- MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms)
-
- /* sound hardware */
- MCFG_SPEAKER_STANDARD_MONO("mono")
-
+ /* actually, PSG is embedded in the VDP chip */
MCFG_SOUND_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PAL/15)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
-
- MCFG_SMS_CARTRIDGE_ADD("slot", sms_cart, nullptr)
-
- MCFG_SOFTWARE_LIST_ADD("cart_list","sms")
-
- MCFG_SMS_CONTROL_PORT_ADD(CONTROL1_TAG, sms_control_port_devices, "joypad")
- MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl1_th_input))
- MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color))
-
- MCFG_SMS_CONTROL_PORT_ADD(CONTROL2_TAG, sms_control_port_devices, "joypad")
- MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(sms_state, sms_ctrl2_th_input))
- MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_state, sms_pixel_color))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( sms2_pal, sms_pal_base )
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240)
- MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL))
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PAL/10)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
@@ -668,28 +694,18 @@ static MACHINE_CONFIG_DERIVED( sms1_pal, sms_pal_base )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
- MCFG_CPU_IO_MAP(sms_io)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240)
- MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL))
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PAL/10)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD
- MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240)
- MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL))
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PAL/10)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD
- MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 2, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 + 10, \
- SEGA315_5124_HEIGHT_PAL, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_PAL_240_TBORDER_HEIGHT + 240)
- MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_PAL/10 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_PAL))
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PAL/10)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1)
@@ -707,26 +723,180 @@ static MACHINE_CONFIG_DERIVED( sms1_pal, sms_pal_base )
// card and expansion slots, not present in Master System II
MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SMS_EXPANSION_ADD("exp", sms_expansion_devices, nullptr)
+ MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+MACHINE_CONFIG_END
+
+
+static MACHINE_CONFIG_DERIVED( sms_paln_base, sms_base )
+ /* basic machine hardware */
+ MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_PALN/3)
+ MCFG_CPU_PROGRAM_MAP(sms_mem)
+ MCFG_CPU_IO_MAP(sms_io)
+
+ MCFG_QUANTUM_TIME(attotime::from_hz(50))
+
+ /* actually, PSG is embedded in the VDP chip */
+ MCFG_SOUND_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PALN/3)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sms3_paln, sms_paln_base )
+
+ /* video hardware */
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PALN/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
+
+ MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
+ MCFG_SEGA315_5246_SET_SCREEN("screen")
+ MCFG_SEGA315_5246_IS_PAL(true)
+ MCFG_SEGA315_5246_INT_CB(INPUTLINE("maincpu", 0))
+ MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback))
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sms1_paln, sms_paln_base )
+
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
+
+ /* video hardware */
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PALN/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+
+ MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PALN/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+
+ MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD
+ MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PALN/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+
+ MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1)
+
+ MCFG_DEFAULT_LAYOUT(layout_sms1)
+
+ MCFG_VIDEO_START_OVERRIDE(sms_state,sms1)
+ MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1)
+
+ MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0)
+ MCFG_SEGA315_5124_SET_SCREEN("screen")
+ MCFG_SEGA315_5124_IS_PAL(true)
+ MCFG_SEGA315_5124_INT_CB(INPUTLINE("maincpu", 0))
+ MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback))
+
+ // card and expansion slots, not present in Tec Toy Master System III
+ MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
+ MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+MACHINE_CONFIG_END
+
+
+static MACHINE_CONFIG_DERIVED( sms_br_base, sms_base )
+ /* basic machine hardware */
+ MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_PALM/3)
+ MCFG_CPU_PROGRAM_MAP(sms_mem)
+ MCFG_CPU_IO_MAP(sms_io)
+
+ // PAL-M has near the same frequency of NTSC
+ MCFG_QUANTUM_TIME(attotime::from_hz(60))
+
+ /* actually, PSG is embedded in the VDP chip */
+ MCFG_SOUND_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PALM/3)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sms3_br, sms_br_base )
+ /* video hardware */
+ // PAL-M height/width parameters are the same of NTSC screens.
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(MASTER_CLOCK_PALM/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
+
+ MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
+ MCFG_SEGA315_5246_SET_SCREEN("screen")
+ MCFG_SEGA315_5246_IS_PAL(false) // PAL-M has same line count of NTSC
+ MCFG_SEGA315_5246_INT_CB(INPUTLINE("maincpu", 0))
+ MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback))
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( sms1_br, sms_br_base )
+
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
+
+ /* video hardware */
+ // PAL-M height/width parameters are the same of NTSC screens.
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(MASTER_CLOCK_PALM/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+
+ MCFG_SCREEN_ADD("left_lcd", LCD) // This is needed for SegaScope Left LCD
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(MASTER_CLOCK_PALM/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+
+ MCFG_SCREEN_ADD("right_lcd", LCD) // This is needed for SegaScope Right LCD
+ MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(MASTER_CLOCK_PALM/2)
+ MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms1)
+
+ MCFG_SCREEN_VBLANK_DRIVER(sms_state, screen_vblank_sms1)
+
+ MCFG_DEFAULT_LAYOUT(layout_sms1)
+
+ MCFG_VIDEO_START_OVERRIDE(sms_state,sms1)
+ MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1)
+
+ MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0)
+ MCFG_SEGA315_5124_SET_SCREEN("screen")
+ MCFG_SEGA315_5124_IS_PAL(false) // PAL-M has same line count of NTSC
+ MCFG_SEGA315_5124_INT_CB(INPUTLINE("maincpu", 0))
+ MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(sms_state, sms_pause_callback))
+
+ // card and expansion slots, not present in Tec Toy Master System III
+ MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
+ MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+MACHINE_CONFIG_END
+
+
+static MACHINE_CONFIG_DERIVED( sms2_kr, sms2_ntsc )
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_IO_MAP(smskr_io)
+
+ MCFG_DEVICE_REMOVE("slot")
+ MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr)
+ MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( sms1_kr, sms1_ntsc )
MCFG_CPU_MODIFY("maincpu")
- MCFG_CPU_IO_MAP(smsj_io)
+ MCFG_CPU_IO_MAP(smskr_io)
MCFG_DEVICE_REMOVE("slot")
MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr)
+ MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000")
+
+ MCFG_DEVICE_MODIFY("sms_vdp")
+ MCFG_SEGA315_5124_CSYNC_CB(WRITELINE(sms_state, sms_csync_callback))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( smsj, sms1_kr )
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_IO_MAP(smsj_io)
+
MCFG_SOUND_ADD("ym2413", YM2413, XTAL_10_738635MHz/3)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( sg1000m3, smsj )
+static MACHINE_CONFIG_DERIVED( sg1000m3, sms1_ntsc )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_IO_MAP(sg1000m3_io)
+ MCFG_DEVICE_REMOVE("slot")
+ MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr)
+ MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000")
+
+ MCFG_DEVICE_REMOVE("smsexp")
+ MCFG_SG1000_EXPANSION_ADD("sgexp", sg1000_expansion_devices, nullptr, false)
+
// Mark III does not have TH connected.
MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL1_TAG)
MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NOOP)
@@ -734,14 +904,6 @@ static MACHINE_CONFIG_DERIVED( sg1000m3, smsj )
MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NOOP)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_DERIVED( sms2_kr, sms2_ntsc )
- MCFG_CPU_MODIFY("maincpu")
- MCFG_CPU_IO_MAP(smsj_io)
-
- MCFG_DEVICE_REMOVE("slot")
- MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr)
-MACHINE_CONFIG_END
-
static MACHINE_CONFIG_START( gamegear, sms_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_GG/9)
@@ -755,10 +917,7 @@ static MACHINE_CONFIG_START( gamegear, sms_state )
/* video hardware */
MCFG_SCREEN_ADD("screen", LCD)
- MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_GG/6, \
- SEGA315_5124_WIDTH, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 6*8, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 26*8, \
- SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 3*8, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_192_TBORDER_HEIGHT + 21*8 )
- MCFG_SCREEN_REFRESH_RATE((double) MASTER_CLOCK_GG/6 / (SEGA315_5124_WIDTH * SEGA315_5124_HEIGHT_NTSC))
+ MCFG_SCREEN_GG_RAW_PARAMS(MASTER_CLOCK_GG/6)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_gamegear)
MCFG_VIDEO_START_OVERRIDE(sms_state,gamegear)
@@ -880,6 +1039,57 @@ ROM_START(smskr)
ROMX_LOAD("akbioskr.rom", 0x000, 0x20000, CRC(9c5bad91) SHA1(2feafd8f1c40fdf1bd5668f8c5c02e5560945b17), ROM_BIOS(1))
ROM_END
+ROM_START(sms1br)
+ ROM_REGION(0x4000, "maincpu", 0)
+ ROM_FILL(0x0000, 0x4000, 0xff)
+
+ ROM_REGION(0x20000, "user1", 0)
+ ROM_SYSTEM_BIOS( 0, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" )
+ ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91e93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(1))
+ROM_END
+
+ROM_START(sms2br)
+ ROM_REGION(0x4000, "maincpu", 0)
+ ROM_FILL(0x0000, 0x4000, 0xff)
+
+ ROM_REGION(0x40000, "user1", 0)
+ ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" )
+ ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1))
+ROM_END
+
+ROM_START(smsbr)
+ ROM_REGION(0x4000, "maincpu", 0)
+ ROM_FILL(0x0000, 0x4000, 0xff)
+
+ ROM_REGION(0x40000, "user1", 0)
+ ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" )
+ ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1))
+ ROM_SYSTEM_BIOS( 1, "sonic", "European/Brazilian BIOS with Sonic the Hedgehog (1991)" )
+ ROMX_LOAD("sonbios.rom", 0x0000, 0x40000, CRC(81c3476b) SHA1(6aca0e3dffe461ba1cb11a86cd4caf5b97e1b8df), ROM_BIOS(2))
+ ROM_SYSTEM_BIOS( 2, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" )
+ ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91e93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(3))
+ROM_END
+
+ROM_START(sms2paln)
+ ROM_REGION(0x4000, "maincpu", 0)
+ ROM_FILL(0x0000, 0x4000, 0xff)
+
+ ROM_REGION(0x40000, "user1", 0)
+ ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" )
+ ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1))
+ ROM_SYSTEM_BIOS( 1, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" )
+ ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(e79bb689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(2))
+ROM_END
+
+ROM_START(smspaln)
+ ROM_REGION(0x4000, "maincpu", 0)
+ ROM_FILL(0x0000, 0x4000, 0xff)
+
+ ROM_REGION(0x40000, "user1", 0)
+ ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" )
+ ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(cf4a09ea) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1))
+ROM_END
+
ROM_START(gamegear)
ROM_REGION(0x4000, "maincpu", 0)
ROM_FILL(0x0000, 0x4000, 0x00)
@@ -893,6 +1103,7 @@ ROM_END
#define rom_gamegeaj rom_gamegear
#define rom_sms1krfm rom_smsj
#define rom_sms1kr rom_smsj
+#define rom_sms1paln rom_sms1br
/***************************************************************************
@@ -938,11 +1149,11 @@ ROM_END
- built-in Sonic the Hedgehog - 1991
BR
- - Tec Toy Master System (I) (same as sms1)
+ - Tec Toy Master System (I) (sms1br)
- built-in Hang On/Safari Hunt v2.4 - 1989
- - Tec Toy Master System II (same as sms1)
+ - Tec Toy Master System II (sms2br)
- built-in Alex Kidd in Miracle World - 1991
- - Tec Toy Master System III Compact (same as sms)
+ - Tec Toy Master System III Compact (smsbr)
- built-in Alex Kidd in Miracle World - 1992
- built-in Sonic the Hedgehog - 1993
- built-in World Cup Italia '90 (Super Futebol II) - 1994
@@ -955,10 +1166,21 @@ ROM_END
- built-in Monica no Castelo do Dragao - 1994
- built-in Sonic the Hedgehog (T. Monica em O Resgate pack) - 199?
Notes about BR:
- - PAL-M has same frequency and line count of NTSC
+ - PAL-M has the same line count and near the same frequency of NTSC
- Tec Toy later changed its logo twice and its name to Tectoy
- 20XX models (Handy, Collection, Evolution...) likely have SoC hardware
+ PAL-N (Argentina, Paraguay, Uruguay)
+ - Tec Toy Master System (I) (sms1paln)
+ - built-in Hang On/Safari Hunt v2.4
+ - Tec Toy Master System II (sms2paln)
+ - built-in Alex Kidd in Miracle World
+ - built-in Missile Defense 3-D v4.4
+ - Tec Toy Master System III Compact (smspaln)
+ - built-in Alex Kidd in Miracle World
+ Notes:
+ - Distributed by: Gameland (Argentina), Forstar (Uruguay)
+
These are coin-operated machines (stuff for MAME):
- Sega Game Box 9
@@ -972,17 +1194,23 @@ ROM_END
***************************************************************************/
-/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
-CONS( 1985, sg1000m3, sms, 0, sg1000m3, sg1000m3, sms_state, sg1000m3, "Sega", "Mark III", MACHINE_SUPPORTS_SAVE )
-CONS( 1986, sms1, sms, 0, sms1_ntsc, sms1, sms_state, sms1, "Sega", "Master System I", MACHINE_SUPPORTS_SAVE )
-CONS( 1986, sms1pal, sms, 0, sms1_pal, sms1, sms_state, sms1, "Sega", "Master System I (PAL)" , MACHINE_SUPPORTS_SAVE )
-CONS( 1986, smssdisp, sms, 0, sms_sdisp, smssdisp, smssdisp_state, smssdisp, "Sega", "Master System Store Display Unit", MACHINE_SUPPORTS_SAVE )
-CONS( 1987, smsj, sms, 0, smsj, smsj, sms_state, smsj, "Sega", "Master System (Japan)", MACHINE_SUPPORTS_SAVE )
-CONS( 1990, sms, 0, 0, sms2_ntsc, sms, sms_state, sms1, "Sega", "Master System II", MACHINE_SUPPORTS_SAVE )
-CONS( 1990, smspal, sms, 0, sms2_pal, sms, sms_state, sms1, "Sega", "Master System II (PAL)", MACHINE_SUPPORTS_SAVE )
-CONS( 1989, sms1krfm, sms, 0, smsj, smsj, sms_state, smsj, "Samsung", "Gam*Boy I (Korea) (FM)", MACHINE_SUPPORTS_SAVE )
-CONS( 19??, sms1kr, sms, 0, sms1_kr, smsj, sms_state, sms1kr, "Samsung", "Gam*Boy I (Korea)", MACHINE_SUPPORTS_SAVE )
-CONS( 1991, smskr, sms, 0, sms2_kr, sms, sms_state, smskr, "Samsung", "Gam*Boy II (Korea)", MACHINE_SUPPORTS_SAVE )
+/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
+CONS( 1985, sg1000m3, sms, 0, sg1000m3, sg1000m3, sms_state, sg1000m3, "Sega", "Mark III", MACHINE_SUPPORTS_SAVE )
+CONS( 1986, sms1, sms, 0, sms1_ntsc, sms1, sms_state, sms1, "Sega", "Master System I", MACHINE_SUPPORTS_SAVE )
+CONS( 1986, sms1pal, sms, 0, sms1_pal, sms1, sms_state, sms1, "Sega", "Master System I (PAL)" , MACHINE_SUPPORTS_SAVE )
+CONS( 1986, smssdisp, sms, 0, sms_sdisp, smssdisp, smssdisp_state, smssdisp, "Sega", "Master System Store Display Unit", MACHINE_SUPPORTS_SAVE )
+CONS( 1987, smsj, sms, 0, smsj, smsj, sms_state, smsj, "Sega", "Master System (Japan)", MACHINE_SUPPORTS_SAVE )
+CONS( 1990, sms, 0, 0, sms2_ntsc, sms, sms_state, sms, "Sega", "Master System II", MACHINE_SUPPORTS_SAVE )
+CONS( 1990, smspal, sms, 0, sms2_pal, sms, sms_state, sms, "Sega", "Master System II (PAL)", MACHINE_SUPPORTS_SAVE )
+CONS( 1989, sms1krfm, sms, 0, smsj, smsj, sms_state, smsj, "Samsung", "Gam*Boy I (Korea) (FM)", MACHINE_SUPPORTS_SAVE )
+CONS( 19??, sms1kr, sms, 0, sms1_kr, smsj, sms_state, sms1kr, "Samsung", "Gam*Boy I (Korea)", MACHINE_SUPPORTS_SAVE )
+CONS( 1991, smskr, sms, 0, sms2_kr, sms, sms_state, smskr, "Samsung", "Gam*Boy II (Korea)", MACHINE_SUPPORTS_SAVE )
+CONS( 1989, sms1br, sms, 0, sms1_br, sms1, sms_state, sms1, "Tec Toy", "Master System I (Brazil)", MACHINE_SUPPORTS_SAVE )
+CONS( 1991, sms2br, sms, 0, sms1_br, sms1, sms_state, sms1, "Tec Toy", "Master System II (Brazil)", MACHINE_SUPPORTS_SAVE )
+CONS( 1992, smsbr, sms, 0, sms3_br, sms, sms_state, sms, "Tec Toy", "Master System III Compact (Brazil)", MACHINE_SUPPORTS_SAVE )
+CONS( 19??, sms1paln, sms, 0, sms1_paln, sms1, sms_state, sms1, "Tec Toy", "Master System I (PAL-N)", MACHINE_SUPPORTS_SAVE )
+CONS( 19??, sms2paln, sms, 0, sms1_paln, sms1, sms_state, sms1, "Tec Toy", "Master System II (PAL-N)", MACHINE_SUPPORTS_SAVE )
+CONS( 19??, smspaln, sms, 0, sms3_paln, sms, sms_state, sms, "Tec Toy", "Master System III Compact (PAL-N)", MACHINE_SUPPORTS_SAVE )
-CONS( 1991, gamegear, 0, sms, gamegear, gg, sms_state, gamegear, "Sega", "Game Gear (Europe/America)", MACHINE_SUPPORTS_SAVE )
-CONS( 1990, gamegeaj, gamegear, 0, gamegear, gg, sms_state, gamegeaj, "Sega", "Game Gear (Japan)", MACHINE_SUPPORTS_SAVE )
+CONS( 1991, gamegear, 0, sms, gamegear, gg, sms_state, gamegear, "Sega", "Game Gear (Europe/America)", MACHINE_SUPPORTS_SAVE )
+CONS( 1990, gamegeaj, gamegear, 0, gamegear, gg, sms_state, gamegeaj, "Sega", "Game Gear (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/vt240.cpp b/src/mame/drivers/vt240.cpp
index a88e129e0cf..5706a76c7d7 100644
--- a/src/mame/drivers/vt240.cpp
+++ b/src/mame/drivers/vt240.cpp
@@ -97,10 +97,6 @@ public:
DECLARE_READ16_MEMBER(mem_r);
DECLARE_WRITE16_MEMBER(mem_w);
- //UINT16 m_pcg_addr;
- //UINT8 m_pcg_internal_addr;
- //UINT8 *m_char_rom;
-
DECLARE_DRIVER_INIT(vt240);
virtual void machine_reset() override;
UPD7220_DISPLAY_PIXELS_MEMBER(hgdc_draw);
@@ -121,8 +117,8 @@ WRITE_LINE_MEMBER(vt240_state::write_keyboard_clock)
WRITE_LINE_MEMBER(vt240_state::i8085_rdy_w)
{
- //m_maincpu->set_input_line(T11_IRQ1, state ? ASSERT_LINE : CLEAR_LINE);
- m_i8085_rdy = !state;
+ m_maincpu->set_input_line(3, state ? CLEAR_LINE : ASSERT_LINE);
+ m_i8085_rdy = state;
}
READ_LINE_MEMBER(vt240_state::i8085_sid_r)
@@ -498,24 +494,8 @@ ROM_START( vt240 )
ROM_LOAD( "23-087j5.e182.e183.jed", 0x0000, 0x1000, NO_DUMP ) // PAL16L8ACN; "Logic Unit" Character Pattern Related
ROM_END
-/* Driver */
-DRIVER_INIT_MEMBER(vt240_state,vt240)
-{
- UINT8 *ROM = memregion("charcpu")->base();
-
- /* patch T11 check */
- ROM[0x09d] = 0x00;
- ROM[0x09e] = 0x00;
- ROM[0x09f] = 0x00;
-
- /* ROM checksum */
- ROM[0x15c] = 0x00;
- ROM[0x15d] = 0x00;
- ROM[0x15e] = 0x00;
-}
-
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
-COMP( 1983, vt240, 0, 0, vt240, 0, vt240_state, vt240, "Digital Equipment Corporation", "VT240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
+COMP( 1983, vt240, 0, 0, vt240, 0, driver_device, 0, "Digital Equipment Corporation", "VT240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
//COMP( 1983, vt241, 0, 0, vt220, vt220, driver_device, 0, "Digital Equipment Corporation", "VT241", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
// NOTE: the only difference between VT240 and VT241 is the latter comes with a VR241 Color monitor, while the former comes with a mono display; the ROMs and operation are identical.
-COMP( 1983, mc7105, 0, 0, mc7105, 0, vt240_state, vt240, "Elektronika", "MC7105", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
+COMP( 1983, mc7105, 0, 0, mc7105, 0, driver_device, 0, "Elektronika", "MC7105", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
diff --git a/src/mame/includes/model2.h b/src/mame/includes/model2.h
index eee82ff360a..0a747d0cc3d 100644
--- a/src/mame/includes/model2.h
+++ b/src/mame/includes/model2.h
@@ -8,6 +8,7 @@
#include "sound/scsp.h"
#include "machine/315-5881_crypt.h"
#include "machine/315-5838_317-0229_comp.h"
+#include "machine/m2comm.h"
class model2_renderer;
struct raster_state;
@@ -30,6 +31,7 @@ public:
m_maincpu(*this,"maincpu"),
m_dsbz80(*this, DSBZ80_TAG),
m_m1audio(*this, "m1audio"),
+ m_m2comm(*this, "m2comm"),
m_audiocpu(*this, "audiocpu"),
m_tgp(*this, "tgp"),
m_dsp(*this, "dsp"),
@@ -58,6 +60,7 @@ public:
required_device m_maincpu;
optional_device m_dsbz80; // Z80-based MPEG Digital Sound Board
optional_device m_m1audio; // Model 1 standard sound board
+ optional_device m_m2comm; // Model 2 communication board
optional_device m_audiocpu;
optional_device m_tgp;
optional_device m_dsp;
diff --git a/src/mame/includes/sg1000.h b/src/mame/includes/sg1000.h
index 3f994977f7b..673b457d468 100644
--- a/src/mame/includes/sg1000.h
+++ b/src/mame/includes/sg1000.h
@@ -5,15 +5,14 @@
#include "emu.h"
#include "cpu/z80/z80.h"
-#include "formats/sc3000_bit.h"
#include "formats/sf7000_dsk.h"
-#include "imagedev/cassette.h"
#include "imagedev/printer.h"
#include "bus/centronics/ctronics.h"
#include "machine/i8255.h"
#include "machine/i8251.h"
#include "machine/ram.h"
#include "bus/sega8/sega8_slot.h"
+#include "bus/sg1000_exp/sg1000exp.h"
#include "machine/upd765.h"
#include "sound/sn76496.h"
#include "video/tms9928a.h"
@@ -25,15 +24,14 @@
#define UPD765_TAG "upd765"
#define UPD8251_TAG "upd8251"
#define UPD9255_TAG "upd9255"
-#define UPD9255_0_TAG "upd9255_0"
-#define UPD9255_1_TAG "upd9255_1"
+#define UPD9255_1_TAG "upd9255_1" // "upd9255_0" is being used by sk1100 device
#define CENTRONICS_TAG "centronics"
#define TMS9918A_TAG "tms9918a"
#define RS232_TAG "rs232"
#define CARTSLOT_TAG "slot"
+#define EXPSLOT_TAG "sgexp"
-INPUT_PORTS_EXTERN( sk1100 );
class sg1000_state : public driver_device
{
@@ -48,75 +46,38 @@ public:
m_maincpu(*this, Z80_TAG),
m_ram(*this, RAM_TAG),
m_rom(*this, Z80_TAG),
- m_cart(*this, CARTSLOT_TAG)
+ m_cart(*this, CARTSLOT_TAG),
+ m_sgexpslot(*this, EXPSLOT_TAG),
+ m_pa7(*this, "PA7"),
+ m_pb7(*this, "PB7")
{ }
required_device m_maincpu;
required_device m_ram;
required_memory_region m_rom;
optional_device m_cart;
+ optional_device m_sgexpslot;
+ required_ioport m_pa7;
+ required_ioport m_pb7;
virtual void machine_start() override;
- DECLARE_READ8_MEMBER( joysel_r );
+ DECLARE_READ8_MEMBER( peripheral_r );
+ DECLARE_WRITE8_MEMBER( peripheral_w );
DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi );
DECLARE_READ8_MEMBER( omv_r );
DECLARE_WRITE8_MEMBER( omv_w );
-
- /* keyboard state */
- UINT8 m_keylatch;
};
class sc3000_state : public sg1000_state
{
public:
sc3000_state(const machine_config &mconfig, device_type type, const char *tag)
- : sg1000_state(mconfig, type, tag),
- m_cassette(*this, "cassette"),
- m_pa0(*this, "PA0"),
- m_pa1(*this, "PA1"),
- m_pa2(*this, "PA2"),
- m_pa3(*this, "PA3"),
- m_pa4(*this, "PA4"),
- m_pa5(*this, "PA5"),
- m_pa6(*this, "PA6"),
- m_pa7(*this, "PA7"),
- m_pb0(*this, "PB0"),
- m_pb1(*this, "PB1"),
- m_pb2(*this, "PB2"),
- m_pb3(*this, "PB3"),
- m_pb4(*this, "PB4"),
- m_pb5(*this, "PB5"),
- m_pb6(*this, "PB6"),
- m_pb7(*this, "PB7")
+ : sg1000_state(mconfig, type, tag)
{ }
- required_device m_cassette;
- required_ioport m_pa0;
- required_ioport m_pa1;
- required_ioport m_pa2;
- required_ioport m_pa3;
- required_ioport m_pa4;
- required_ioport m_pa5;
- required_ioport m_pa6;
- required_ioport m_pa7;
- required_ioport m_pb0;
- required_ioport m_pb1;
- required_ioport m_pb2;
- required_ioport m_pb3;
- required_ioport m_pb4;
- required_ioport m_pb5;
- required_ioport m_pb6;
- required_ioport m_pb7;
-
- virtual void machine_start() override;
-
- DECLARE_READ8_MEMBER( ppi_pa_r );
- DECLARE_READ8_MEMBER( ppi_pb_r );
- DECLARE_WRITE8_MEMBER( ppi_pc_w );
-
- ioport_port* m_key_row[16];
+ virtual void machine_start() override;
};
class sf7000_state : public sc3000_state
diff --git a/src/mame/includes/sms.h b/src/mame/includes/sms.h
index 259a3f6fd65..2d16c1f9a2c 100644
--- a/src/mame/includes/sms.h
+++ b/src/mame/includes/sms.h
@@ -22,6 +22,7 @@
#define CONTROL2_TAG "ctrl2"
#include "bus/sega8/sega8_slot.h"
+#include "bus/sg1000_exp/sg1000exp.h"
#include "bus/sms_exp/smsexp.h"
#include "bus/sms_ctrl/smsctrl.h"
#include "bus/gamegear/ggext.h"
@@ -44,6 +45,7 @@ public:
m_port_gg_dc(*this, "GG_PORT_DC"),
m_port_pause(*this, "PAUSE"),
m_port_reset(*this, "RESET"),
+ m_port_rapid(*this, "RAPID"),
m_port_start(*this, "START"),
m_port_scope(*this, "SEGASCOPE"),
m_port_scope_binocular(*this, "SSCOPE_BINOCULAR"),
@@ -51,14 +53,13 @@ public:
m_region_maincpu(*this, "maincpu"),
m_mainram(nullptr),
m_is_gamegear(0),
- m_is_gg_region_japan(0),
m_is_smsj(0),
m_is_mark_iii(0),
m_is_sdisp(0),
+ m_ioctrl_region_is_japan(0),
m_has_bios_0400(0),
m_has_bios_2000(0),
m_has_bios_full(0),
- m_has_fm(0),
m_has_jpn_sms_cart_slot(0),
m_store_cart_selection_data(0) { }
@@ -76,6 +77,7 @@ public:
optional_ioport m_port_gg_dc;
optional_ioport m_port_pause;
optional_ioport m_port_reset;
+ optional_ioport m_port_rapid;
optional_ioport m_port_start;
optional_ioport m_port_scope;
optional_ioport m_port_scope_binocular;
@@ -104,14 +106,13 @@ public:
// model identifiers
UINT8 m_is_gamegear;
- UINT8 m_is_gg_region_japan;
UINT8 m_is_smsj;
UINT8 m_is_mark_iii;
UINT8 m_is_sdisp;
+ UINT8 m_ioctrl_region_is_japan;
UINT8 m_has_bios_0400;
UINT8 m_has_bios_2000;
UINT8 m_has_bios_full;
- UINT8 m_has_fm;
UINT8 m_has_jpn_sms_cart_slot;
// [0] for 0x400-0x3fff, [1] for 0x4000-0x7fff, [2] for 0x8000-0xffff, [3] for 0x0000-0x0400
@@ -122,7 +123,7 @@ public:
UINT8 m_io_ctrl_reg;
UINT8 m_mem_ctrl_reg;
UINT8 m_mem_device_enabled;
- UINT8 m_audio_control;
+ UINT8 m_smsj_audio_control;
UINT8 m_port_dc_reg;
UINT8 m_port_dd_reg;
UINT8 m_gg_sio[5];
@@ -140,10 +141,18 @@ public:
UINT8 m_sscope_state;
UINT8 m_frame_sscope_state;
+ // Data needed for Rapid button (smsj, sms1kr, sms1krfm)
+ UINT16 m_csync_counter;
+ UINT8 m_rapid_mode;
+ UINT8 m_rapid_read_state;
+ UINT8 m_rapid_last_dc;
+ UINT8 m_rapid_last_dd;
+
// slot devices
sega8_cart_slot_device *m_cartslot;
sega8_card_slot_device *m_cardslot;
- sms_expansion_slot_device *m_expslot;
+ sms_expansion_slot_device *m_smsexpslot;
+ sg1000_expansion_slot_device *m_sgexpslot;
// these are only used by the Store Display unit, but we keep them here temporarily to avoid the need of separate start/reset
sega8_cart_slot_device *m_slots[16];
@@ -168,19 +177,22 @@ public:
DECLARE_READ8_MEMBER(sms_input_port_dc_r);
DECLARE_READ8_MEMBER(sms_input_port_dd_r);
DECLARE_READ8_MEMBER(gg_input_port_00_r);
+ DECLARE_READ8_MEMBER(sg1000m3_peripheral_r);
+ DECLARE_WRITE8_MEMBER(sg1000m3_peripheral_w);
DECLARE_READ8_MEMBER(gg_sio_r);
DECLARE_WRITE8_MEMBER(gg_sio_w);
DECLARE_WRITE8_MEMBER(gg_psg_stereo_w);
DECLARE_WRITE8_MEMBER(gg_psg_w);
DECLARE_WRITE8_MEMBER(sms_psg_w);
- DECLARE_READ8_MEMBER(sms_audio_control_r);
- DECLARE_WRITE8_MEMBER(sms_audio_control_w);
- DECLARE_WRITE8_MEMBER(sms_ym2413_register_port_w);
- DECLARE_WRITE8_MEMBER(sms_ym2413_data_port_w);
+ DECLARE_READ8_MEMBER(smsj_audio_control_r);
+ DECLARE_WRITE8_MEMBER(smsj_audio_control_w);
+ DECLARE_WRITE8_MEMBER(smsj_ym2413_register_port_w);
+ DECLARE_WRITE8_MEMBER(smsj_ym2413_data_port_w);
DECLARE_READ8_MEMBER(sms_sscope_r);
DECLARE_WRITE8_MEMBER(sms_sscope_w);
DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
+ DECLARE_WRITE_LINE_MEMBER(sms_csync_callback);
DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input);
DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input);
DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input);
@@ -194,6 +206,7 @@ public:
DECLARE_DRIVER_INIT(smskr);
DECLARE_DRIVER_INIT(smsj);
DECLARE_DRIVER_INIT(sms1);
+ DECLARE_DRIVER_INIT(sms);
DECLARE_MACHINE_START(sms);
DECLARE_MACHINE_RESET(sms);
DECLARE_VIDEO_START(gamegear);
diff --git a/src/mame/machine/dec_lk201.cpp b/src/mame/machine/dec_lk201.cpp
index 2164171dce0..353856f928c 100644
--- a/src/mame/machine/dec_lk201.cpp
+++ b/src/mame/machine/dec_lk201.cpp
@@ -3,8 +3,9 @@
/*
DEC LK-201 keyboard
Emulation by R. Belmont & M. Burke
+with contributions by Cracyc and Karl-Ludwig Deisenhofer (2016)
- This is the later "cost-reduced" 6805 version; there's also an 8048 version.
+This is the later "cost-reduced" 6805 version with green LEDs; there's also an 8048 version.
The LK-201 mechanical elements are described in US Patent 4,467,150
*/
@@ -101,7 +102,6 @@ ________|D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0
C:D - Cursor down (B17)
C:U - Cursor up (C17)
C:R - Cursor right (B18)
- C:L - Cursor left (B16)
*/
#include "emu.h"
@@ -180,7 +180,12 @@ const device_type LK201 = &device_creator;
ROM_START( lk201 )
ROM_REGION(0x2000, LK201_CPU_TAG, 0)
+
+// 23-001s9-00.bin is for the newer LK201 version (green LEDs, Motorola 6805)
ROM_LOAD( "23-001s9-00.bin", 0x0000, 0x2000, CRC(be293c51) SHA1(a11ae004d2d6055d7279da3560c3e56610a19fdb) )
+
+// 23-004M1 or 23-004M2 are in the older LK201 keyboard with red LEDs (8051)
+
ROM_END
//-------------------------------------------------
@@ -206,7 +211,7 @@ static MACHINE_CONFIG_FRAGMENT( lk201 )
MCFG_CPU_PROGRAM_MAP(lk201_map)
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD(LK201_SPK_TAG, BEEP, 3250)
+ MCFG_SOUND_ADD(LK201_SPK_TAG, BEEP, 2000)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
@@ -496,6 +501,8 @@ void lk201_device::device_start()
{
m_count = timer_alloc(1);
m_tx_handler.resolve_safe();
+
+ m_beeper = timer_alloc(2);
}
@@ -505,6 +512,14 @@ void lk201_device::device_start()
void lk201_device::device_reset()
{
+ m_beeper->adjust(attotime::never);
+
+ m_speaker->set_state(0);
+ m_speaker->set_output_gain(0, 0);
+
+ ddrs[0] = ddrs[1] = ddrs[2] = 0;
+ ports[0] = ports[1] = ports[2] = 0;
+
set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_rate(4800);
m_count->adjust(attotime::from_hz(1200), 0, attotime::from_hz(1200));
@@ -524,22 +539,35 @@ void lk201_device::device_reset()
void lk201_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- if(id == 1)
+ switch (id)
{
- if(m_timer.tcr & 0x40)
+ case 1:
+ m_timer.tsr |= TSR_OCFL;
+
+ if ((m_timer.tcr & TCR_OCIE) && (m_timer.tsr & TSR_OCFL))
m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
- m_timer.tsr |= 0x40;
- }
- else
+ break;
+
+ case 2:
+ m_speaker->set_output_gain(0, 0);
+ m_speaker->set_state(0);
+ break;
+
+ default:
device_serial_interface::device_timer(timer, id, param, ptr);
}
+}
+
void lk201_device::rcv_complete()
{
sci_status |= SCSR_RDRF;
update_interrupts();
receive_register_extract();
-// printf("lk201 got %02x\n", get_received_char());
+
+ int data = get_received_char();
+ m_kbd_state = data;
+// printf("\nlk201 got %02x\n", m_kbd_state);
}
void lk201_device::tra_complete()
@@ -567,7 +595,21 @@ void lk201_device::update_interrupts()
READ8_MEMBER( lk201_device::timer_r )
{
+ static UINT16 count;
+
UINT8 ret = m_timer.regs[offset];
+
+ switch (offset)
+ {
+ case 8: // ACRH (high value is stored and reused when reading low)
+ count = (m_maincpu->total_cycles() / 4) & 0x0000ffff;
+ ret = count >> 8;
+ break;
+ case 9: // ACRL
+ ret = count & 0x00ff;
+ break;
+ }
+
if(m_timer.tsr)
{
m_timer.tsr = 0;
@@ -578,7 +620,26 @@ READ8_MEMBER( lk201_device::timer_r )
WRITE8_MEMBER( lk201_device::timer_w )
{
+ static UINT16 count;
+ static int save_tsr;
+
m_timer.regs[offset] = data;
+
+ switch (offset)
+ {
+ case 4: // OCRH
+ save_tsr = m_timer.tsr; // prevent crashes in between OCRH / OCRL loads
+ m_timer.tsr &= (255-TSR_OCFL); // OCFL flag tested for zero in TIMER routine
+
+ count = m_timer.ocrh << 8; // store for later (when LOW is written).
+ break;
+ case 5 : // OCRL
+ count |= m_timer.ocrl;
+ m_timer.ocrh = count >> 8;
+
+ m_timer.tsr = save_tsr; // restore flags
+ break;
+ }
}
READ8_MEMBER( lk201_device::ddr_r )
@@ -612,13 +673,13 @@ READ8_MEMBER( lk201_device::ports_r )
WRITE8_MEMBER( lk201_device::ports_w )
{
UINT8 olddata = ports[offset];
- ports[offset] = data;
+ ports[offset] = data; // "port writes are independent of DDRC"
send_port(space, offset, olddata & ddrs[offset]);
+// printf("\nPORT %c write %02x (OLD = %02x) (DDR = %02x) (PC=%x)\n", 'A' + offset, data, olddata, ddrs[offset], m_maincpu->pc());
}
void lk201_device::send_port(address_space &space, UINT8 offset, UINT8 olddata)
{
-// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->pc());
UINT8 porta = ports[0] & ddrs[0];
UINT8 portb = ports[1] & ddrs[1];
UINT8 portc = ports[2] & ddrs[2];
@@ -654,17 +715,60 @@ void lk201_device::send_port(address_space &space, UINT8 offset, UINT8 olddata)
if (portc & 0x1) kbd_data = m_kbd16->read();
if (portc & 0x2) kbd_data = m_kbd17->read();
}
+
// Check for LED update strobe
if (((portc & 0x80) == 0) && (olddata & 0x80))
{
- // Lower nibble contains the LED values (1 = on, 0 = off)
+ if(ddrs[2] != 0x00)
+ { // Lower nibble contains the LED values (1 = on, 0 = off)
machine().output().set_value("led_wait" , (led_data & 0x1) == 1);
machine().output().set_value("led_compose", (led_data & 0x2) == 2);
machine().output().set_value("led_lock" , (led_data & 0x4) == 4);
machine().output().set_value("led_hold" , (led_data & 0x8) == 8);
}
- break;
+ if (led_data & 0xf0)
+ {
+ m_speaker->set_state(1);
+ // Beeps < 20 ms are clipped. A key click on a LK201 lasts 2 ms...
+ if(m_kbd_state == LK_CMD_BELL)
+ m_beeper->adjust(attotime::from_msec(125));
+ else
+ m_beeper->adjust(attotime::from_msec(25)); // see note
}
+ // Upper 4 bits of LED_DATA contain encoded volume info
+ switch (led_data & 0xf0)
+ {
+ case 0xf0: // 8 - (see TABLE 4 in 68HC05xx ROM)
+ m_speaker->set_output_gain(0, 100.0f);
+ break;
+ case 0xd0: // 7
+ m_speaker->set_output_gain(0, (100 - (12 * 1)) / 100.0f);
+ break;
+ case 0xc0: // 6
+ m_speaker->set_output_gain(0, (100 - (12 * 2)) / 100.0f);
+ break;
+ case 0x60: // 5
+ m_speaker->set_output_gain(0, (100 - (12 * 3)) / 100.0f);
+ break;
+ case 0xb0: // 4
+ m_speaker->set_output_gain(0, (100 - (12 * 4)) / 100.0f);
+ break;
+ case 0xa0: // 3
+ m_speaker->set_output_gain(0, (100 - (12 * 5)) / 100.0f);
+ break;
+ case 0x30: // 2
+ m_speaker->set_output_gain(0, (100 - (12 * 6)) / 100.0f);
+ break;
+ case 0x90: // 1
+ m_speaker->set_output_gain(0, (100 - (12 * 7)) / 100.0f);
+ break;
+ default:
+ ;
+ } // switch (volume)
+
+ } // if (update_strobe)
+
+ } // outer switch
}
READ8_MEMBER( lk201_device::sci_r )
diff --git a/src/mame/machine/dec_lk201.h b/src/mame/machine/dec_lk201.h
index 0871f1c3c4e..1df36577b7b 100644
--- a/src/mame/machine/dec_lk201.h
+++ b/src/mame/machine/dec_lk201.h
@@ -17,14 +17,19 @@
#define LK_CMD_DIS_KEYCLK 0x99 /* disable the keyclick */
#define LK_CMD_ENB_KEYCLK 0x1b /* enable the keyclick - 1st param: volume */
-//#define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */
-//#define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */
+#define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */
+#define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */
#define LK_CMD_SOUND_CLK 0x9f /* emit a keyclick - 1st param: volume */
#define LK_CMD_DIS_BELL 0xa1 /* disable the bell */
#define LK_CMD_ENB_BELL 0x23 /* enable the bell - 1st param: volume */
#define LK_CMD_BELL 0xa7 /* emit a bell - 1st param: volume */
-#define LK_CMD_POWER_UP 0xfd /* init power-up sequence */
+// TCR - Timer Compare Register
+#define TCR_OCIE 0x40 // Bit 6 (output compare IRQ enable)
+#define TCR_OLVL 0x01 // Bit 1 (output level)
+
+// TSR - Timer Status Register
+#define TSR_OCFL 0x40 // TSR (68HC05 output compare flag)
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
@@ -45,16 +50,16 @@ public:
// construction/destruction
lk201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- DECLARE_READ8_MEMBER( ddr_r );
- DECLARE_WRITE8_MEMBER( ddr_w );
- DECLARE_READ8_MEMBER( ports_r );
- DECLARE_WRITE8_MEMBER( ports_w );
- DECLARE_READ8_MEMBER( sci_r );
- DECLARE_WRITE8_MEMBER( sci_w );
- DECLARE_READ8_MEMBER( spi_r );
- DECLARE_WRITE8_MEMBER( spi_w );
- DECLARE_READ8_MEMBER( timer_r );
- DECLARE_WRITE8_MEMBER( timer_w );
+ DECLARE_READ8_MEMBER(ddr_r);
+ DECLARE_WRITE8_MEMBER(ddr_w);
+ DECLARE_READ8_MEMBER(ports_r);
+ DECLARE_WRITE8_MEMBER(ports_w);
+ DECLARE_READ8_MEMBER(sci_r);
+ DECLARE_WRITE8_MEMBER(sci_w);
+ DECLARE_READ8_MEMBER(spi_r);
+ DECLARE_WRITE8_MEMBER(spi_w);
+ DECLARE_READ8_MEMBER(timer_r);
+ DECLARE_WRITE8_MEMBER(timer_w);
template static devcb_base &set_tx_handler(device_t &device, _Object wr) { return downcast(device).m_tx_handler.set_callback(wr); }
@@ -95,6 +100,7 @@ private:
} m_timer;
emu_timer *m_count;
+ emu_timer *m_beeper;
UINT8 sci_ctl2;
UINT8 sci_status;
@@ -128,6 +134,8 @@ private:
void send_port(address_space &space, UINT8 offset, UINT8 data);
void update_interrupts();
+ int m_kbd_state;
+
devcb_write_line m_tx_handler;
};
diff --git a/src/mame/machine/m2comm.cpp b/src/mame/machine/m2comm.cpp
index 4c45669076c..f5c7036f2f4 100644
--- a/src/mame/machine/m2comm.cpp
+++ b/src/mame/machine/m2comm.cpp
@@ -79,6 +79,7 @@ Sega PC BD MODEL2 A-CRX COMMUNICATION 837-11525
EEPROM:
16726.7 Sega Rally Championship
+ 18643.7 ManxTT
18643A.7 ManxTT
@@ -163,6 +164,8 @@ Sega PC BD MODEL2 C-CRX COMMUNICATION 837-12839
18643A.7 Sega Touring Car Championship
*/
+#include "emu.h"
+#include "emuopts.h"
#include "machine/m2comm.h"
//#define __M2COMM_VERBOSE__
@@ -228,7 +231,6 @@ void m2comm_device::device_start()
void m2comm_device::device_reset()
{
- set_linktype(16726);
m_zfg = 0;
m_cn = 0;
m_fg = 0;
@@ -295,8 +297,9 @@ WRITE8_MEMBER(m2comm_device::cn_w)
m_linkid = 0x00;
m_linkalive = 0x00;
m_linkcount = 0x00;
- m_linktimer = 0x04; //0x00E8; // 58 fps * 4s
+ m_linktimer = 0x00E8; // 58 fps * 4s
+ comm_init();
comm_tick();
}
#endif
@@ -321,46 +324,38 @@ void m2comm_device::check_vint_irq()
}
#ifdef __M2COMM_SIMULATION__
-void m2comm_device::set_linktype(UINT16 linktype)
+void m2comm_device::comm_init()
{
- m_linktype = linktype;
+ // TODO - check EPR-16726 on Daytona USA and Sega Rally Championship
+ // EPR-18643(A) - these are accessed by VirtuaON and Sega Touring Car Championship
+
+ // frameSize - 0xe00
+ m_shared[0x12] = 0x00;
+ m_shared[0x13] = 0x0e;
- switch (m_linktype)
- {
- case 16726:
- // Daytona USA / Sega Rally Championship
- printf("M2COMM: set mode 'EPR-16726 - Daytona USA'\n");
- break;
- }
+ // frameOffset - 0x1c0
+ m_shared[0x14] = 0xc0;
+ m_shared[0x15] = 0x01;
}
void m2comm_device::comm_tick()
-{
- switch (m_linktype)
- {
- case 16726:
- // Daytona USA / Sega Rally Championship
- comm_tick_16726();
- break;
- }
-}
-
-void m2comm_device::comm_tick_16726()
{
if (m_linkenable == 0x01)
{
m_zfg ^= 1;
-
- int frameStart = 0x2000;
- int frameOffset = 0x0000;
- int frameSize = 0x01c0;
+
+ int frameSize = m_shared[0x13] << 8 | m_shared[0x12];
+ int frameOffset = m_shared[0x15] << 8 | m_shared[0x14];
+
int dataSize = frameSize + 1;
int togo = 0;
int recv = 0;
int idx = 0;
- bool isMaster = (m_fg == 0x01);
- bool isSlave = (m_fg == 0x00);
+ // EPR-16726 uses m_fg for Master/Slave
+ // EPR-18643(A) seems to check m_shared[1], with a fallback to m_fg
+ bool isMaster = (m_fg == 0x01 || m_shared[1] == 0x01);
+ bool isSlave = !isMaster && (m_fg == 0x00);
// if link not yet established...
if (m_linkalive == 0x00)
@@ -409,8 +404,8 @@ void m2comm_device::comm_tick_16726()
}
else if (isSlave)
{
+ // increase linkcount
m_buffer[1]++;
- m_linkid = m_buffer[1];
// forward message
m_line_tx.write(m_buffer, dataSize);
@@ -422,7 +417,10 @@ void m2comm_device::comm_tick_16726()
{
if (isSlave)
{
+ // fetch linkcount and linkid, then decrease linkid
m_linkcount = m_buffer[1];
+ m_linkid = m_buffer[2];
+ m_buffer[2]--;
// forward message
m_line_tx.write(m_buffer, dataSize);
@@ -431,6 +429,7 @@ void m2comm_device::comm_tick_16726()
// consider it done
printf("M2COMM: link established - id %02x of %02x\n", m_linkid, m_linkcount);
m_linkalive = 0x01;
+ m_linktimer = 0x01;
// write to shared mem
m_shared[0] = 0x01;
@@ -464,6 +463,7 @@ void m2comm_device::comm_tick_16726()
{
m_buffer[0] = 0xff;
m_buffer[1] = 0x01;
+ m_buffer[2] = 0x00;
m_line_tx.write(m_buffer, dataSize);
}
@@ -472,11 +472,13 @@ void m2comm_device::comm_tick_16726()
{
m_buffer[0] = 0xfe;
m_buffer[1] = m_linkcount;
+ m_buffer[2] = m_linkcount;
m_line_tx.write(m_buffer, dataSize);
// consider it done
printf("M2COMM: link established - id %02x of %02x\n", m_linkid, m_linkcount);
m_linkalive = 0x01;
+ m_linktimer = 0x00;
// write to shared mem
m_shared[0] = 0x01;
@@ -503,52 +505,16 @@ void m2comm_device::comm_tick_16726()
int recv = m_line_rx.read(m_buffer, dataSize);
while (recv != 0)
{
+ m_linktimer = 0x00;
// check if complete message
if (recv == dataSize)
{
// check if valid id
int idx = m_buffer[0];
- if (idx > 0 && idx <= m_linkcount) {
- int slotFrom = m_linkid - idx;
- int slotDest = slotFrom + m_linkcount;
- while (slotDest < 9) {
- slotDest += m_linkcount;
- }
- while (slotDest - m_linkcount > 0) {
- slotFrom = slotDest - m_linkcount;
- if (slotDest < 9) {
- int frameOffset1 = frameStart + slotFrom * frameSize;
- int frameOffset2 = frameStart + slotDest * frameSize;
- for (int j = 0x00 ; j < frameSize ; j++)
- {
- m_shared[frameOffset2 + j] = m_shared[frameOffset1 + j];
- }
- }
- slotDest -= m_linkcount;
- }
- if (slotDest > 0) {
- // save message to "ring buffer"
- frameOffset = frameStart + (slotDest * frameSize);
- for (int j = 0x00 ; j < frameSize ; j++)
- {
- m_shared[frameOffset + j] = m_buffer[1 + j];
- }
- }
- if (idx != m_linkid)
+ if (idx >= 0 && idx <= m_linkcount) {
+ for (int j = 0x00 ; j < frameSize ; j++)
{
- // forward message to other nodes
- m_line_tx.write(m_buffer, dataSize);
- }
- } else {
- if (!isMaster && idx == 0xF0){
- // 0xF0 - master addional bytes
- for (int j = 0x05 ; j < 0x10 ; j++)
- {
- m_shared[j] = m_buffer[1 + j];
- }
-
- // forward message to other nodes
- m_line_tx.write(m_buffer, dataSize);
+ m_shared[0x2000 + frameOffset + j] = m_buffer[1 + j];
}
}
}
@@ -566,32 +532,18 @@ void m2comm_device::comm_tick_16726()
recv = m_line_rx.read(m_buffer, dataSize);
}
- // push message to other nodes
- m_buffer[0] = m_linkid;
- for (int j = 0x00 ; j < frameSize ; j++)
+ if (m_linktimer == 0x00)
{
- m_buffer[1 + j] = m_shared[frameStart + j];
- }
- m_line_tx.write(m_buffer, dataSize);
-
- // master sends some additional status bytes
- if (isMaster){
- m_buffer[0] = 0xF0;
+ // push message to other nodes
+ m_buffer[0] = m_linkid;
for (int j = 0x00 ; j < frameSize ; j++)
{
- m_buffer[1 + j] = 0x00;
+ m_buffer[1 + j] = m_shared[0x2000 + j];
}
- for (int j = 0x05 ; j < 0x10 ; j++)
- {
- m_buffer[1 + j] = m_shared[j];
- }
- // push message to other nodes
m_line_tx.write(m_buffer, dataSize);
+ m_linktimer = 0x01;
}
}
-
- // clear 03
- //TODO:m_shared[3] = 0x00;
}
}
#endif
diff --git a/src/mame/machine/m2comm.h b/src/mame/machine/m2comm.h
index 8566f2cdd33..020ac38fbb2 100644
--- a/src/mame/machine/m2comm.h
+++ b/src/mame/machine/m2comm.h
@@ -77,9 +77,8 @@ private:
UINT16 m_linktype;
+ void comm_init();
void comm_tick();
-
- void comm_tick_16726();
#endif
};
diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp
index 8244b542759..8941b2513f2 100644
--- a/src/mame/machine/sms.cpp
+++ b/src/mame/machine/sms.cpp
@@ -250,6 +250,69 @@ WRITE_LINE_MEMBER(sms_state::sms_pause_callback)
}
+WRITE_LINE_MEMBER(sms_state::sms_csync_callback)
+{
+ if ( m_port_rapid )
+ {
+ UINT8 rapid_previous_mode = m_rapid_mode;
+
+ m_csync_counter++;
+ // counter is 12 bits wide (for 4096 pulses)
+ m_csync_counter &= 0xfff;
+
+ if (!(m_port_rapid->read() & 0x01)) // Rapid button is pressed
+ {
+ sms_get_inputs();
+
+ if (m_port_dc_reg != m_rapid_last_dc)
+ {
+ // Enable/disable rapid fire for any joypad button pressed.
+ m_rapid_mode ^= (~m_port_dc_reg & 0x30) >> 4;
+ m_rapid_last_dc = m_port_dc_reg;
+ }
+ if (m_port_dd_reg != m_rapid_last_dd)
+ {
+ // Enable/disable rapid fire for any joypad button pressed.
+ m_rapid_mode ^= (~m_port_dd_reg & 0x0c);
+ m_rapid_last_dd = m_port_dd_reg;
+ }
+ }
+ else // Rapid button is not pressed
+ {
+ m_rapid_last_dc = 0xff;
+ m_rapid_last_dd = 0xff;
+ }
+
+ if ((m_rapid_mode & 0x0f) != 0) // Rapid Fire enabled for a button
+ {
+ // Timings for Rapid Fire and LED verified by Charles MacDonald.
+
+ // Read state is changed at each 256 C-Sync pulses
+ if ((m_csync_counter & 0xff) == 0)
+ {
+ m_rapid_read_state ^= 0xff;
+ }
+
+ // Power LED blinks while Rapid Fire is enabled.
+ // It switches between on/off at each 2048 C-Sync pulses.
+ if ((m_csync_counter & 0x7ff) == 0)
+ {
+ output().set_led_value(0, !output().get_led_value(0));
+ }
+ }
+ else // Rapid Fire disabled
+ {
+ if ((rapid_previous_mode & 0x0f) != 0) // it was enabled
+ {
+ m_rapid_read_state = 0x00;
+ // Power LED remains lit again
+ output().set_led_value(0, 1);
+ }
+ }
+ }
+}
+
+
READ8_MEMBER(sms_state::sms_input_port_dc_r)
{
if (m_is_mark_iii)
@@ -282,6 +345,17 @@ READ8_MEMBER(sms_state::sms_input_port_dc_r)
m_port_dc_reg &= ~0x20 | ((m_io_ctrl_reg & 0x10) << 1);
}
+ if ( m_port_rapid )
+ {
+ // Check if Rapid Fire is enabled for Button 1
+ if (m_rapid_mode & 0x01)
+ m_port_dc_reg |= m_rapid_read_state & 0x10;
+
+ // Check if Rapid Fire is enabled for Button 2
+ if (m_rapid_mode & 0x02)
+ m_port_dc_reg |= m_rapid_read_state & 0x20;
+ }
+
return m_port_dc_reg;
}
@@ -325,7 +399,7 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r)
// Check if TH of controller port 1 is set to output (0)
if (!(m_io_ctrl_reg & 0x02))
{
- if (m_is_smsj || (m_is_gamegear && m_is_gg_region_japan))
+ if (m_ioctrl_region_is_japan)
{
m_port_dd_reg &= ~0x40;
}
@@ -347,7 +421,7 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r)
// Check if TH of controller port 2 is set to output (0)
if (!(m_io_ctrl_reg & 0x08))
{
- if (m_is_smsj || (m_is_gamegear && m_is_gg_region_japan))
+ if (m_ioctrl_region_is_japan)
{
m_port_dd_reg &= ~0x80;
}
@@ -366,73 +440,69 @@ READ8_MEMBER(sms_state::sms_input_port_dd_r)
}
}
+ if ( m_port_rapid )
+ {
+ // Check if Rapid Fire is enabled for Button 1
+ if (m_rapid_mode & 0x04)
+ m_port_dd_reg |= m_rapid_read_state & 0x04;
+
+ // Check if Rapid Fire is enabled for Button 2
+ if (m_rapid_mode & 0x08)
+ m_port_dd_reg |= m_rapid_read_state & 0x08;
+ }
+
return m_port_dd_reg;
}
-WRITE8_MEMBER(sms_state::sms_audio_control_w)
+WRITE8_MEMBER(sms_state::smsj_audio_control_w)
{
- if (m_has_fm)
- {
- if (m_is_smsj)
- m_audio_control = data & 0x03;
- else
- m_audio_control = data & 0x01;
- }
+ m_smsj_audio_control = data & 0x03;
}
-READ8_MEMBER(sms_state::sms_audio_control_r)
+READ8_MEMBER(sms_state::smsj_audio_control_r)
{
- if (m_has_fm)
- {
- if (m_is_smsj)
- {
- /* Charles MacDonald discovered an internal 12-bit counter that is
- incremented on each pulse of the C-Sync line that connects the VDP
- with the 315-5297. Only 3 bits of the counter are returned when
- read this port:
+ UINT8 data;
- D7 : Counter bit 11
- D6 : Counter bit 7
- D5 : Counter bit 3
- D4 : Always zero
- D3 : Always zero
- D2 : Always zero
- D1 : Mute control bit 1
- D0 : Mute control bit 0
+ /* Charles MacDonald discovered an internal 12-bit counter that is
+ incremented on each pulse of the C-Sync line that connects the VDP
+ with the 315-5297. Only 3 bits of the counter are returned when
+ read this port:
- For the moment, only the mute bits are handled by this code.
- */
- return m_audio_control & 0x03;
- }
- else
- return m_audio_control & 0x01;
- }
- else
- return sms_input_port_dc_r(space, offset);
+ D7 : Counter bit 11
+ D6 : Counter bit 7
+ D5 : Counter bit 3
+ D4 : Always zero
+ D3 : Always zero
+ D2 : Always zero
+ D1 : Mute control bit 1
+ D0 : Mute control bit 0
+
+ */
+ data = 0x00;
+ data |= (m_smsj_audio_control & 0x03);
+ data |= (m_csync_counter & 0x008) << 2;
+ data |= (m_csync_counter & 0x080) >> 1;
+ data |= (m_csync_counter & 0x800) >> 4;
+
+ return data;
}
-WRITE8_MEMBER(sms_state::sms_ym2413_register_port_w)
+WRITE8_MEMBER(sms_state::smsj_ym2413_register_port_w)
{
- if (m_has_fm)
- {
- if (m_audio_control == 0x01 || m_audio_control == 0x03)
- m_ym->write(space, 0, data & 0x3f);
- }
+ if (m_smsj_audio_control == 0x01 || m_smsj_audio_control == 0x03)
+ m_ym->write(space, 0, data & 0x3f);
}
-WRITE8_MEMBER(sms_state::sms_ym2413_data_port_w)
+WRITE8_MEMBER(sms_state::smsj_ym2413_data_port_w)
{
- if (m_has_fm)
+ if (m_smsj_audio_control == 0x01 || m_smsj_audio_control == 0x03)
{
- if (m_audio_control == 0x01 || m_audio_control == 0x03)
- {
- //logerror("data_port_w %x %x\n", offset, data);
- m_ym->write(space, 1, data);
- }
+ //logerror("data_port_w %x %x\n", offset, data);
+ m_ym->write(space, 1, data);
}
}
@@ -441,7 +511,7 @@ WRITE8_MEMBER(sms_state::sms_psg_w)
{
if (m_is_smsj)
{
- if (m_audio_control != 0x00 && m_audio_control != 0x03)
+ if (m_smsj_audio_control != 0x00 && m_smsj_audio_control != 0x03)
return;
}
@@ -471,7 +541,7 @@ READ8_MEMBER(sms_state::gg_input_port_00_r)
else
{
// bit 6 is NJAP (0=domestic/1=overseas); bit 7 is STT (START button)
- UINT8 data = (m_is_gg_region_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80);
+ UINT8 data = (m_ioctrl_region_is_japan ? 0x00 : 0x40) | (m_port_start->read() & 0x80);
// According to GG official docs, bits 0-4 are meaningless and bit 5
// is NNTS (0=NTSC, 1=PAL). All games run in NTSC and no original GG
@@ -488,6 +558,9 @@ READ8_MEMBER(sms_state::sms_sscope_r)
{
int sscope = m_port_scope->read();
+ // On SMSJ, address $fffb also controls the built-in 3-D port, that works
+ // in parallel with the 3-D adapter that is inserted into the card slot.
+
if ( sscope )
{
// Scope is attached
@@ -513,7 +586,8 @@ WRITE8_MEMBER(sms_state::sms_sscope_w)
// active screen. Most cases are solid-color frames of scene transitions, but
// one exception is the first frame of Zaxxon 3-D's title screen. In that
// case, this method is enough for setting the intended state for the frame.
- // No information found about a minimum time need for switch open/closed lens.
+ // According to Charles MacDonald: "It takes around 10 scanlines for the
+ // display to transition from fully visible to fully obscured by the shutter".
if (m_main_scr->vpos() < (m_main_scr->height() >> 1))
{
m_frame_sscope_state = m_sscope_state;
@@ -533,7 +607,7 @@ READ8_MEMBER(sms_state::read_ram)
if (m_mem_device_enabled & ENABLE_CARD)
data &= m_cardslot->read_ram(space, offset);
if (m_mem_device_enabled & ENABLE_EXPANSION)
- data &= m_expslot->read_ram(space, offset);
+ data &= m_smsexpslot->read_ram(space, offset);
return data;
}
@@ -553,7 +627,7 @@ WRITE8_MEMBER(sms_state::write_ram)
if (m_mem_device_enabled & ENABLE_CARD)
m_cardslot->write_ram(space, offset, data);
if (m_mem_device_enabled & ENABLE_EXPANSION)
- m_expslot->write_ram(space, offset, data);
+ m_smsexpslot->write_ram(space, offset, data);
}
else
{
@@ -593,7 +667,7 @@ WRITE8_MEMBER(sms_state::sms_mapper_w)
}
if (m_mem_device_enabled & ENABLE_EXPANSION) // expansion slot
{
- m_expslot->write_mapper(space, offset, data);
+ m_smsexpslot->write_mapper(space, offset, data);
}
break;
@@ -617,7 +691,7 @@ WRITE8_MEMBER(sms_state::sms_mapper_w)
}
if (m_mem_device_enabled & ENABLE_EXPANSION)
{
- m_expslot->write_mapper(space, offset, data);
+ m_smsexpslot->write_mapper(space, offset, data);
}
break;
}
@@ -655,7 +729,7 @@ UINT8 sms_state::read_bus(address_space &space, unsigned int page, UINT16 base_a
if (m_mem_device_enabled & ENABLE_CARD)
data &= m_cardslot->read_cart(space, base_addr + offset);
if (m_mem_device_enabled & ENABLE_EXPANSION)
- data &= m_expslot->read(space, base_addr + offset);
+ data &= m_smsexpslot->read(space, base_addr + offset);
return data;
}
@@ -692,7 +766,7 @@ WRITE8_MEMBER(sms_state::write_cart)
if (m_mem_device_enabled & ENABLE_CARD)
m_cardslot->write_cart(space, offset, data);
if (m_mem_device_enabled & ENABLE_EXPANSION)
- m_expslot->write(space, offset, data);
+ m_smsexpslot->write(space, offset, data);
}
@@ -723,6 +797,35 @@ WRITE8_MEMBER(sms_state::sms_mem_control_w)
}
+READ8_MEMBER(sms_state::sg1000m3_peripheral_r)
+{
+ bool joy_ports_disabled = m_sgexpslot->is_readable(offset);
+
+ if (joy_ports_disabled)
+ {
+ return m_sgexpslot->read(space, offset);
+ }
+ else
+ {
+ if (offset & 0x01)
+ return sms_input_port_dd_r(space, offset);
+ else
+ return sms_input_port_dc_r(space, offset);
+ }
+}
+
+
+WRITE8_MEMBER(sms_state::sg1000m3_peripheral_w)
+{
+ bool joy_ports_disabled = m_sgexpslot->is_writeable(offset);
+
+ if (joy_ports_disabled)
+ {
+ m_sgexpslot->write(space, offset, data);
+ }
+}
+
+
WRITE8_MEMBER(sms_state::gg_sio_w)
{
if (m_cartslot->exists() && m_cartslot->m_cart->get_sms_mode())
@@ -803,7 +906,7 @@ void sms_state::setup_enabled_slots()
return;
}
- if (!(m_mem_ctrl_reg & IO_EXPANSION) && m_expslot && m_expslot->m_device)
+ if (!(m_mem_ctrl_reg & IO_EXPANSION) && m_smsexpslot && m_smsexpslot->m_device)
{
m_mem_device_enabled |= ENABLE_EXPANSION;
logerror("Expansion port enabled.\n");
@@ -864,7 +967,7 @@ void sms_state::setup_media_slots()
else if (m_mem_device_enabled & ENABLE_CARD)
m_lphaser_x_offs = m_cardslot->m_cart->get_lphaser_xoffs();
else if (m_mem_device_enabled & ENABLE_EXPANSION)
- m_lphaser_x_offs = m_expslot->m_device->get_lphaser_xoffs();
+ m_lphaser_x_offs = m_smsexpslot->m_device->get_lphaser_xoffs();
if (m_lphaser_x_offs == -1)
m_lphaser_x_offs = 36;
@@ -913,7 +1016,8 @@ MACHINE_START_MEMBER(sms_state,sms)
m_cartslot = machine().device("slot");
m_cardslot = machine().device("mycard");
- m_expslot = machine().device("exp");
+ m_smsexpslot = machine().device("smsexp");
+ m_sgexpslot = machine().device("sgexp");
m_space = &m_maincpu->space(AS_PROGRAM);
if (m_mainram == nullptr)
@@ -945,9 +1049,18 @@ MACHINE_START_MEMBER(sms_state,sms)
save_item(NAME(m_port_dd_reg));
save_item(NAME(m_mem_device_enabled));
- if (m_has_fm)
+ if (m_is_smsj)
{
- save_item(NAME(m_audio_control));
+ save_item(NAME(m_smsj_audio_control));
+ }
+
+ if (m_port_rapid)
+ {
+ save_item(NAME(m_csync_counter));
+ save_item(NAME(m_rapid_mode));
+ save_item(NAME(m_rapid_read_state));
+ save_item(NAME(m_rapid_last_dc));
+ save_item(NAME(m_rapid_last_dd));
}
if (!m_is_mark_iii)
@@ -993,8 +1106,21 @@ MACHINE_START_MEMBER(sms_state,sms)
MACHINE_RESET_MEMBER(sms_state,sms)
{
- if (m_has_fm)
- m_audio_control = 0x00;
+ if (m_is_smsj)
+ {
+ m_smsj_audio_control = 0x00;
+ }
+
+ if (m_port_rapid)
+ {
+ m_csync_counter = 0;
+ m_rapid_mode = 0x00;
+ m_rapid_read_state = 0;
+ m_rapid_last_dc = 0xff;
+ m_rapid_last_dd = 0xff;
+ // Power LED remains lit again
+ output().set_led_value(0, 1);
+ }
if (!m_is_mark_iii)
{
@@ -1111,14 +1237,23 @@ WRITE_LINE_MEMBER(smssdisp_state::sms_store_int_callback)
DRIVER_INIT_MEMBER(sms_state,sg1000m3)
{
m_is_mark_iii = 1;
- m_has_fm = 1;
m_has_jpn_sms_cart_slot = 1;
+ // turn on the Power LED
+ output().set_led_value(0, 1);
+}
+
+
+DRIVER_INIT_MEMBER(sms_state,sms)
+{
+ m_has_bios_full = 1;
}
DRIVER_INIT_MEMBER(sms_state,sms1)
{
m_has_bios_full = 1;
+ // turn on the Power LED
+ output().set_led_value(0, 1);
}
@@ -1126,15 +1261,20 @@ DRIVER_INIT_MEMBER(sms_state,smsj)
{
m_is_smsj = 1;
m_has_bios_2000 = 1;
- m_has_fm = 1;
+ m_ioctrl_region_is_japan = 1;
m_has_jpn_sms_cart_slot = 1;
+ // turn on the Power LED
+ output().set_led_value(0, 1);
}
DRIVER_INIT_MEMBER(sms_state,sms1kr)
{
m_has_bios_2000 = 1;
+ m_ioctrl_region_is_japan = 1;
m_has_jpn_sms_cart_slot = 1;
+ // turn on the Power LED
+ output().set_led_value(0, 1);
}
@@ -1156,6 +1296,8 @@ DRIVER_INIT_MEMBER(sms_state,gamegear)
{
m_is_gamegear = 1;
m_has_bios_0400 = 1;
+ // turn on the Power LED
+ output().set_led_value(0, 1);
}
@@ -1163,7 +1305,9 @@ DRIVER_INIT_MEMBER(sms_state,gamegeaj)
{
m_is_gamegear = 1;
m_has_bios_0400 = 1;
- m_is_gg_region_japan = 1;
+ m_ioctrl_region_is_japan = 1;
+ // turn on the Power LED
+ output().set_led_value(0, 1);
}
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 09a5f35c2fb..c3c4c0b883a 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -14197,6 +14197,7 @@ mjkinjas // (c) 1991 Home Data
mjkojink // (c) 1989 Home Data
mjprivat // (c) 1991 Matoba
mjyougo // (c) 1989 Home Data
+mjjoship // (c) 1988 Home Data
mrokumei // (c) 1988 Home Data
reikaids // (c) 1988 Home Data
vitaminc // (c) 1989 Home Data
@@ -33275,12 +33276,18 @@ gamegear // Sega GameGear
sg1000m3 // Sega SG-1000 Mark III (Japan)
sms // Sega Master System II (NTSC)
sms1 // Sega Master System I (NTSC)
+sms1br // Tec Toy Master System I (Brazil)
sms1kr // Samsung Gam*Boy I (Korea)
sms1krfm // Samsung Gam*Boy I (Korea) with FM Chip
sms1pal // Sega Master System I (PAL)
+sms1paln // Tec Toy Master System I (PAL-N)
+sms2br // Tec Toy Master System II (Brazil)
+sms2paln // Tec Toy Master System II (PAL-N)
+smsbr // Tec Toy Master System III Compact (Brazil)
smsj // Sega Master System (Japan) with FM Chip
smskr // Samsung Gam*Boy II (Korea)
smspal // Sega Master System II (PAL)
+smspaln // Tec Toy Master System III Compact (PAL-N)
smssdisp // Sega Master System Store Display Unit
@source:smsmcorp.cpp