msx.cpp: Made the general purpose ports (joystick/mouse) a slot device. (#10579)

* Also moved msx slot devices to subfolders.
This commit is contained in:
wilbertpol 2022-11-24 05:58:31 +00:00 committed by GitHub
parent 6772378b8e
commit be34605ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 531 additions and 259 deletions

View File

@ -1796,97 +1796,113 @@ end
---------------------------------------------------
--
--@src/devices/bus/msx_slot/slot.h,BUSES["MSX_SLOT"] = true
--@src/devices/bus/msx/ctrl/ctrl.h,BUSES["MSX_CTRL"] = true
---------------------------------------------------
if (BUSES["MSX_CTRL"]~=null) then
files {
MAME_DIR .. "src/devices/bus/msx/ctrl/ctrl.cpp",
MAME_DIR .. "src/devices/bus/msx/ctrl/ctrl.h",
MAME_DIR .. "src/devices/bus/msx/ctrl/joystick.cpp",
MAME_DIR .. "src/devices/bus/msx/ctrl/joystick.h",
MAME_DIR .. "src/devices/bus/msx/ctrl/mouse.cpp",
MAME_DIR .. "src/devices/bus/msx/ctrl/mouse.h",
}
end
---------------------------------------------------
--
--@src/devices/bus/msx/slot/slot.h,BUSES["MSX_SLOT"] = true
---------------------------------------------------
if (BUSES["MSX_SLOT"]~=null) then
files {
MAME_DIR .. "src/devices/bus/msx_slot/ax230.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/ax230.h",
MAME_DIR .. "src/devices/bus/msx_slot/bruc100.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/bruc100.h",
MAME_DIR .. "src/devices/bus/msx_slot/bunsetsu.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/bunsetsu.h",
MAME_DIR .. "src/devices/bus/msx_slot/cartridge.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/cartridge.h",
MAME_DIR .. "src/devices/bus/msx_slot/disk.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/disk.h",
MAME_DIR .. "src/devices/bus/msx_slot/fs4600.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/fs4600.h",
MAME_DIR .. "src/devices/bus/msx_slot/fsa1fm.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/fsa1fm.h",
MAME_DIR .. "src/devices/bus/msx_slot/msx_write.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/msx_write.h",
MAME_DIR .. "src/devices/bus/msx_slot/music.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/music.h",
MAME_DIR .. "src/devices/bus/msx_slot/panasonic08.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/panasonic08.h",
MAME_DIR .. "src/devices/bus/msx_slot/rom.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/rom.h",
MAME_DIR .. "src/devices/bus/msx_slot/ram.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/ram.h",
MAME_DIR .. "src/devices/bus/msx_slot/ram_mm.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/ram_mm.h",
MAME_DIR .. "src/devices/bus/msx_slot/msx_rs232.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/msx_rs232.h",
MAME_DIR .. "src/devices/bus/msx_slot/slot.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/slot.h",
MAME_DIR .. "src/devices/bus/msx_slot/sony08.cpp",
MAME_DIR .. "src/devices/bus/msx_slot/sony08.h",
MAME_DIR .. "src/devices/bus/msx_cart/arc.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/arc.h",
MAME_DIR .. "src/devices/bus/msx_cart/ascii.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/ascii.h",
MAME_DIR .. "src/devices/bus/msx_cart/bm_012.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/bm_012.h",
MAME_DIR .. "src/devices/bus/msx_cart/cartridge.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/cartridge.h",
MAME_DIR .. "src/devices/bus/msx_cart/crossblaim.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/crossblaim.h",
MAME_DIR .. "src/devices/bus/msx_cart/disk.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/disk.h",
MAME_DIR .. "src/devices/bus/msx_cart/dooly.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/dooly.h",
MAME_DIR .. "src/devices/bus/msx_cart/easi_speech.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/easi_speech.h",
MAME_DIR .. "src/devices/bus/msx_cart/fmpac.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/fmpac.h",
MAME_DIR .. "src/devices/bus/msx_cart/fs_sr022.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/fs_sr022.h",
MAME_DIR .. "src/devices/bus/msx_cart/halnote.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/halnote.h",
MAME_DIR .. "src/devices/bus/msx_cart/hfox.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/hfox.h",
MAME_DIR .. "src/devices/bus/msx_cart/holy_quran.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/holy_quran.h",
MAME_DIR .. "src/devices/bus/msx_cart/ink.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/ink.h",
MAME_DIR .. "src/devices/bus/msx_cart/kanji.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/kanji.h",
MAME_DIR .. "src/devices/bus/msx_cart/konami.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/konami.h",
MAME_DIR .. "src/devices/bus/msx_cart/korean.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/korean.h",
MAME_DIR .. "src/devices/bus/msx_cart/majutsushi.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/majutsushi.h",
MAME_DIR .. "src/devices/bus/msx_cart/moonsound.h",
MAME_DIR .. "src/devices/bus/msx_cart/moonsound.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/msx_audio.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/msx_audio.h",
MAME_DIR .. "src/devices/bus/msx_cart/msx_audio_kb.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/msx_audio_kb.h",
MAME_DIR .. "src/devices/bus/msx_cart/msxdos2.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/msxdos2.h",
MAME_DIR .. "src/devices/bus/msx_cart/nomapper.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/nomapper.h",
MAME_DIR .. "src/devices/bus/msx_cart/rtype.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/rtype.h",
MAME_DIR .. "src/devices/bus/msx_cart/superloderunner.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/superloderunner.h",
MAME_DIR .. "src/devices/bus/msx_cart/super_swangi.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/super_swangi.h",
MAME_DIR .. "src/devices/bus/msx_cart/yamaha.cpp",
MAME_DIR .. "src/devices/bus/msx_cart/yamaha.h",
MAME_DIR .. "src/devices/bus/msx/slot/ax230.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/ax230.h",
MAME_DIR .. "src/devices/bus/msx/slot/bruc100.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/bruc100.h",
MAME_DIR .. "src/devices/bus/msx/slot/bunsetsu.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/bunsetsu.h",
MAME_DIR .. "src/devices/bus/msx/slot/cartridge.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/cartridge.h",
MAME_DIR .. "src/devices/bus/msx/slot/disk.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/disk.h",
MAME_DIR .. "src/devices/bus/msx/slot/fs4600.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/fs4600.h",
MAME_DIR .. "src/devices/bus/msx/slot/fsa1fm.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/fsa1fm.h",
MAME_DIR .. "src/devices/bus/msx/slot/msx_write.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/msx_write.h",
MAME_DIR .. "src/devices/bus/msx/slot/music.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/music.h",
MAME_DIR .. "src/devices/bus/msx/slot/panasonic08.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/panasonic08.h",
MAME_DIR .. "src/devices/bus/msx/slot/rom.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/rom.h",
MAME_DIR .. "src/devices/bus/msx/slot/ram.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/ram.h",
MAME_DIR .. "src/devices/bus/msx/slot/ram_mm.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/ram_mm.h",
MAME_DIR .. "src/devices/bus/msx/slot/msx_rs232.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/msx_rs232.h",
MAME_DIR .. "src/devices/bus/msx/slot/slot.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/slot.h",
MAME_DIR .. "src/devices/bus/msx/slot/sony08.cpp",
MAME_DIR .. "src/devices/bus/msx/slot/sony08.h",
MAME_DIR .. "src/devices/bus/msx/cart/arc.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/arc.h",
MAME_DIR .. "src/devices/bus/msx/cart/ascii.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/ascii.h",
MAME_DIR .. "src/devices/bus/msx/cart/bm_012.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/bm_012.h",
MAME_DIR .. "src/devices/bus/msx/cart/cartridge.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/cartridge.h",
MAME_DIR .. "src/devices/bus/msx/cart/crossblaim.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/crossblaim.h",
MAME_DIR .. "src/devices/bus/msx/cart/disk.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/disk.h",
MAME_DIR .. "src/devices/bus/msx/cart/dooly.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/dooly.h",
MAME_DIR .. "src/devices/bus/msx/cart/easi_speech.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/easi_speech.h",
MAME_DIR .. "src/devices/bus/msx/cart/fmpac.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/fmpac.h",
MAME_DIR .. "src/devices/bus/msx/cart/fs_sr022.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/fs_sr022.h",
MAME_DIR .. "src/devices/bus/msx/cart/halnote.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/halnote.h",
MAME_DIR .. "src/devices/bus/msx/cart/hfox.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/hfox.h",
MAME_DIR .. "src/devices/bus/msx/cart/holy_quran.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/holy_quran.h",
MAME_DIR .. "src/devices/bus/msx/cart/ink.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/ink.h",
MAME_DIR .. "src/devices/bus/msx/cart/kanji.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/kanji.h",
MAME_DIR .. "src/devices/bus/msx/cart/konami.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/konami.h",
MAME_DIR .. "src/devices/bus/msx/cart/korean.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/korean.h",
MAME_DIR .. "src/devices/bus/msx/cart/majutsushi.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/majutsushi.h",
MAME_DIR .. "src/devices/bus/msx/cart/moonsound.h",
MAME_DIR .. "src/devices/bus/msx/cart/moonsound.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/msx_audio.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/msx_audio.h",
MAME_DIR .. "src/devices/bus/msx/cart/msx_audio_kb.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/msx_audio_kb.h",
MAME_DIR .. "src/devices/bus/msx/cart/msxdos2.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/msxdos2.h",
MAME_DIR .. "src/devices/bus/msx/cart/nomapper.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/nomapper.h",
MAME_DIR .. "src/devices/bus/msx/cart/rtype.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/rtype.h",
MAME_DIR .. "src/devices/bus/msx/cart/superloderunner.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/superloderunner.h",
MAME_DIR .. "src/devices/bus/msx/cart/super_swangi.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/super_swangi.h",
MAME_DIR .. "src/devices/bus/msx/cart/yamaha.cpp",
MAME_DIR .. "src/devices/bus/msx/cart/yamaha.h",
}
end

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_ARC, msx_cart_arc_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_ASCII8, msx_cart_ascii8_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "cpu/z80/tmpz84c015.h"
#include "bus/midi/midi.h"

View File

@ -29,7 +29,7 @@
#include "super_swangi.h"
#include "yamaha.h"
#include "bus/msx_slot/cartridge.h"
#include "bus/msx/slot/cartridge.h"
void msx_cart(device_slot_interface &device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_CROSSBLAIM, msx_cart_crossblaim_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_DOOLY, msx_cart_dooly_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "sound/sp0256.h"

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "sound/ymopl.h"

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_FS_SR022, msx_cart_fs_sr022_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_HALNOTE, msx_cart_halnote_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_HFOX, msx_cart_hfox_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_HOLY_QURAN, msx_cart_holy_quran_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "machine/intelfsh.h"

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_KANJI, msx_cart_kanji_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "sound/k051649.h"
#include "sound/vlm5030.h"
#include "sound/dac.h"

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_KOREAN_80IN1, msx_cart_korean_80in1_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "sound/dac.h"

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "sound/ymopl.h"

View File

@ -62,7 +62,7 @@ and/or http://ngs.no.coocan.jp/doc/wiki.cgi/datapack?page=4.2+MSX-AUDIO+%B3%C8%C
#include "emu.h"
#include "msx_audio.h"
#include "bus/msx_cart/msx_audio_kb.h"
#include "msx_audio_kb.h"
#include "speaker.h"

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "sound/ymopl.h"
#include "machine/6850acia.h"
#include "bus/midi/midi.h"

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_MSXDOS2, msx_cart_msxdos2_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_NOMAPPER, msx_cart_nomapper_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_RTYPE, msx_cart_rtype_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_SUPER_SWANGI, msx_cart_super_swangi_device)

View File

@ -5,7 +5,7 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
DECLARE_DEVICE_TYPE(MSX_CART_SUPERLODERUNNER, msx_cart_superloderunner_device)

View File

@ -5,9 +5,9 @@
#pragma once
#include "bus/msx_cart/cartridge.h"
#include "cartridge.h"
#include "msx_audio_kb.h"
#include "sound/ymopm.h"
#include "bus/msx_cart/msx_audio_kb.h"
#include "machine/ym2148.h"

View File

@ -0,0 +1,43 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/**********************************************************************
MSX General Purpose port emulation
**********************************************************************/
#include "emu.h"
#include "ctrl.h"
#include "joystick.h"
#include "mouse.h"
DEFINE_DEVICE_TYPE(MSX_GENERAL_PURPOSE_PORT, msx_general_purpose_port_device, "msx_general_purpose_port", "MSX General Purpose port")
device_msx_general_purpose_port_interface::device_msx_general_purpose_port_interface(const machine_config &mconfig, device_t &device)
: device_interface(device, "msxctrl")
, m_port(dynamic_cast<msx_general_purpose_port_device *>(device.owner()))
{
}
msx_general_purpose_port_device::msx_general_purpose_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, MSX_GENERAL_PURPOSE_PORT, tag, owner, clock)
, device_single_card_slot_interface<device_msx_general_purpose_port_interface>(mconfig, *this)
, m_device(nullptr)
{
}
void msx_general_purpose_port_device::device_start()
{
m_device = get_card_device();
}
void msx_general_purpose_port_devices(device_slot_interface &device)
{
device.option_add("joystick", MSX_JOYSTICK);
device.option_add("mouse", MSX_MOUSE);
}

View File

@ -0,0 +1,85 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/**********************************************************************
MSX General Purpose port emulation
The MSX General Purpose port uses a DE-9 connector; the pin assignment
is similar to but slightly different from the Atari VCS controller port.
**********************************************************************/
#ifndef MAME_BUS_MSX_CTRL_CTRL_H
#define MAME_BUS_MSX_CTRL_CTRL_H
#pragma once
class msx_general_purpose_port_device;
class device_msx_general_purpose_port_interface : public device_interface
{
public:
virtual ~device_msx_general_purpose_port_interface() { }
virtual u8 read() { return 0xff; }
virtual void pin_6_w(int state) { }
virtual void pin_7_w(int state) { }
virtual void pin_8_w(int state) { }
protected:
device_msx_general_purpose_port_interface(const machine_config &mconfig, device_t &device);
msx_general_purpose_port_device *m_port;
};
class msx_general_purpose_port_device : public device_t
, public device_single_card_slot_interface<device_msx_general_purpose_port_interface>
{
public:
template <typename T>
msx_general_purpose_port_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, char const* dflt)
: msx_general_purpose_port_device(mconfig, tag, owner)
{
option_reset();
opts(*this);
set_default_option(dflt);
set_fixed(false);
}
msx_general_purpose_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
// computer interface
//
// Data returned by the read method:
// bit 0 - pin 1 - Up (I)
// bit 1 - pin 2 - Down (I)
// bit 2 - pin 3 - Left (I)
// bit 3 - pin 4 - Right (I)
// pin 5 - +5V
// bit 4 - pin 6 - Button 1 (I/O)
// bit 5 - pin 7 - Button 2 (I/O)
// pin 8 - Strobe (O)
// pin 9 - GND
//
u8 read() { return exists() ? m_device->read() : 0xff; }
void pin_6_w(int state) { if (exists()) m_device->pin_6_w(state); }
void pin_7_w(int state) { if (exists()) m_device->pin_7_w(state); }
void pin_8_w(int state) { if (exists()) m_device->pin_8_w(state); }
bool exists() const { return m_device != nullptr; }
protected:
virtual void device_start() override;
device_msx_general_purpose_port_interface *m_device;
};
DECLARE_DEVICE_TYPE(MSX_GENERAL_PURPOSE_PORT, msx_general_purpose_port_device)
void msx_general_purpose_port_devices(device_slot_interface &device);
#endif // MAME_BUS_MSX_CTRL_CTRL_H

View File

@ -0,0 +1,42 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/**********************************************************************
MSX Digital Joystick emulation
**********************************************************************/
#include "emu.h"
#include "joystick.h"
DEFINE_DEVICE_TYPE(MSX_JOYSTICK, msx_joystick_device, "msx_joystick", "MSX Digital Joystick")
static INPUT_PORTS_START(msx_joystick)
PORT_START("JOY")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2)
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
INPUT_PORTS_END
ioport_constructor msx_joystick_device::device_input_ports() const
{
return INPUT_PORTS_NAME(msx_joystick);
}
msx_joystick_device::msx_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, MSX_JOYSTICK, tag, owner, clock)
, device_msx_general_purpose_port_interface(mconfig, *this)
, m_joy(*this, "JOY")
{
}
u8 msx_joystick_device::read()
{
return m_joy->read();
}

View File

@ -0,0 +1,37 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/**********************************************************************
MSX Digital Joystick emulation
**********************************************************************/
#ifndef MAME_BUS_MSX_CTRL_JOYSTICK_H
#define MAME_BUS_MSX_CTRL_JOYSTICK_H
#pragma once
#include "ctrl.h"
class msx_joystick_device : public device_t,
public device_msx_general_purpose_port_interface
{
public:
msx_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual u8 read() override;
protected:
virtual void device_start() override { }
virtual ioport_constructor device_input_ports() const override;
private:
required_ioport m_joy;
};
DECLARE_DEVICE_TYPE(MSX_JOYSTICK, msx_joystick_device)
#endif // MAME_BUS_MSX_CTRL_JOYSTICK_H

View File

@ -0,0 +1,93 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/**********************************************************************
MSX Mouse emulation
**********************************************************************/
#include "emu.h"
#include "mouse.h"
DEFINE_DEVICE_TYPE(MSX_MOUSE, msx_mouse_device, "msx_mouse", "MSX Mouse")
static INPUT_PORTS_START(msx_mouse)
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2)
PORT_BIT(0xcf, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_START("MOUSE_X")
PORT_BIT(0xffff, 0, IPT_MOUSE_X) PORT_SENSITIVITY(50)
PORT_START("MOUSE_Y")
PORT_BIT(0xffff, 0, IPT_MOUSE_Y) PORT_SENSITIVITY(50)
INPUT_PORTS_END
ioport_constructor msx_mouse_device::device_input_ports() const
{
return INPUT_PORTS_NAME(msx_mouse);
}
msx_mouse_device::msx_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, MSX_MOUSE, tag, owner, clock)
, device_msx_general_purpose_port_interface(mconfig, *this)
, m_buttons(*this, "BUTTONS")
, m_port_mouse_x(*this, "MOUSE_X")
, m_port_mouse_y(*this, "MOUSE_Y")
{
}
void msx_mouse_device::device_start()
{
save_item(NAME(m_data));
save_item(NAME(m_stat));
save_item(NAME(m_old_pin8));
save_item(NAME(m_last_pin8_change));
save_item(NAME(m_mouse_x));
save_item(NAME(m_mouse_y));
m_timeout = attotime::from_msec(3);
}
void msx_mouse_device::device_reset()
{
m_data = 0;
m_stat = 3;
m_old_pin8 = 0;
m_last_pin8_change = attotime::zero;
m_mouse_x = 0;
m_mouse_y = 0;
}
u8 msx_mouse_device::read()
{
return (m_buttons->read() & 0xf0) | ((m_data >> (4 * (3 - m_stat))) & 0x0f);
}
void msx_mouse_device::pin_8_w(int state)
{
if (m_old_pin8 != state)
{
attotime now = machine().scheduler().time();
if (now - m_last_pin8_change > m_timeout)
{
// force restart
m_stat = 3;
}
m_last_pin8_change = now;
m_stat = (m_stat + 1) & 0x03;
if (m_stat == 0)
{
s16 mouse_x = m_port_mouse_x->read();
s16 mouse_y = m_port_mouse_y->read();
m_data = (u8(m_mouse_x - mouse_x) << 8) | u8(m_mouse_y - mouse_y);
m_mouse_x = mouse_x;
m_mouse_y = mouse_y;
}
}
m_old_pin8 = state;
}

View File

@ -0,0 +1,49 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
/**********************************************************************
MSX Mouse emulation
**********************************************************************/
#ifndef MAME_BUS_MSX_CTRL_MOUSE_H
#define MAME_BUS_MSX_CTRL_MOUSE_H
#pragma once
#include "ctrl.h"
class msx_mouse_device : public device_t,
public device_msx_general_purpose_port_interface
{
public:
msx_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual u8 read() override;
virtual void pin_8_w(int state) override;
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
private:
required_ioport m_buttons;
required_ioport m_port_mouse_x;
required_ioport m_port_mouse_y;
u16 m_data;
u8 m_stat;
u8 m_old_pin8;
s16 m_mouse_x;
s16 m_mouse_y;
attotime m_last_pin8_change;
attotime m_timeout;
};
DECLARE_DEVICE_TYPE(MSX_MOUSE, msx_mouse_device)
#endif // MAME_BUS_MSX_CTRL_MOUSE_H

View File

@ -5,8 +5,8 @@
#pragma once
#include "bus/msx_slot/slot.h"
#include "bus/msx_slot/rom.h"
#include "rom.h"
#include "slot.h"
DECLARE_DEVICE_TYPE(MSX_SLOT_BUNSETSU, msx_slot_bunsetsu_device)

View File

@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
#include "emu.h"
#include "bus/msx_slot/cartridge.h"
#include "cartridge.h"
#include "hashfile.h"

View File

@ -6,7 +6,7 @@
#pragma once
#include "slot.h"
#include "bus/msx_cart/cartridge.h"
#include "bus/msx/cart/cartridge.h"
#include "imagedev/cartrom.h"

View File

@ -5,8 +5,8 @@
#pragma once
#include "bus/msx_slot/slot.h"
#include "bus/msx_slot/rom.h"
#include "slot.h"
#include "rom.h"
#include "machine/wd_fdc.h"
#include "machine/upd765.h"
#include "imagedev/floppy.h"

View File

@ -5,8 +5,8 @@
#pragma once
#include "bus/msx_slot/slot.h"
#include "bus/msx_slot/rom.h"
#include "rom.h"
#include "slot.h"
#include "sound/ymopl.h"

View File

@ -131,9 +131,8 @@ msx_state::msx_state(const machine_config &mconfig, device_type type, const char
, m_mainirq(*this, "mainirq")
, m_screen(*this, "screen")
, m_region_kanji(*this, "kanji")
, m_io_joy(*this, "JOY%u", 0U)
, m_io_dsw(*this, "DSW")
, m_io_mouse(*this, "MOUSE%u", 0U)
, m_gen_port1(*this, "gen1")
, m_gen_port2(*this, "gen2")
, m_io_key(*this, "KEY%u", 0U)
, m_leds(*this, "led%u", 1U)
, m_view_page0(*this, "view0")
@ -157,8 +156,6 @@ msx_state::msx_state(const machine_config &mconfig, device_type type, const char
, m_view_slot3_page2(*this, "view3_2")
, m_view_slot3_page3(*this, "view3_3")
, m_psg_b(0)
, m_mouse{0, 0}
, m_mouse_stat{0, 0}
, m_kanji_latch(0)
, m_slot_expanded{false, false, false, false}
, m_primary_slot(0)
@ -421,8 +418,6 @@ void msx_state::driver_start()
m_maincpu->z80_set_cycle_tables(cc_op, cc_cb, cc_ed, cc_xy, nullptr, cc_ex);
save_item(NAME(m_psg_b));
save_item(NAME(m_mouse));
save_item(NAME(m_mouse_stat));
save_item(NAME(m_kanji_latch));
save_item(NAME(m_kanji_fsa1fx));
save_item(NAME(m_slot_expanded));
@ -432,53 +427,16 @@ void msx_state::driver_start()
save_item(NAME(m_keylatch));
}
INTERRUPT_GEN_MEMBER(msx_state::msx_interrupt)
{
m_mouse[0] = m_io_mouse[0]->read();
m_mouse_stat[0] = -1;
m_mouse[1] = m_io_mouse[1]->read();
m_mouse_stat[1] = -1;
}
template <u8 Game_port>
u8 msx_state::game_port_r()
{
u8 inp = m_io_joy[Game_port]->read();
if (!(inp & 0x80))
{
// joystick
return (inp & 0x7f);
}
else
{
// mouse
u8 data = (inp & 0x70);
if (m_mouse_stat[Game_port] < 0)
data |= 0xf;
else
data |= ~(m_mouse[Game_port] >> (4 * m_mouse_stat[Game_port])) & 0x0f;
return data;
}
}
u8 msx_state::psg_port_a_r()
{
u8 data = 0x80;
if (m_cassette)
{
data = (m_cassette->input() > 0.0038 ? 0x80 : 0);
}
if ((m_psg_b ^ m_io_dsw->read()) & 0x40)
{
// game port 2
data |= game_port_r<1>();
}
if (BIT(m_psg_b, 6))
data |= m_gen_port2->read() & 0x3f;
else
{
// game port 1
data |= game_port_r<0>();
}
data |= m_gen_port1->read() & 0x3f;
return data;
}
@ -498,16 +456,12 @@ void msx_state::psg_port_b_w(u8 data)
if ((data ^ m_psg_b) & 0x80)
m_leds[1] = BIT(~data, 7);
if ((m_psg_b ^ data) & 0x10)
{
if (++m_mouse_stat[0] > 3)
m_mouse_stat[0] = -1;
}
if ((m_psg_b ^ data) & 0x20)
{
if (++m_mouse_stat[1] > 3)
m_mouse_stat[1] = -1;
}
m_gen_port1->pin_6_w(BIT(data, 0));
m_gen_port1->pin_7_w(BIT(data, 1));
m_gen_port2->pin_6_w(BIT(data, 2));
m_gen_port2->pin_7_w(BIT(data, 3));
m_gen_port1->pin_8_w(BIT(data, 4));
m_gen_port2->pin_8_w(BIT(data, 5));
m_psg_b = data;
}
@ -631,6 +585,9 @@ void msx_state::msx_base(ay8910_type ay8910_type, machine_config &config, XTAL x
m_ay8910->port_b_write_callback().set(FUNC(msx2_base_state::psg_port_b_w));
m_ay8910->add_route(ALL_OUTPUTS, m_speaker, 0.3);
MSX_GENERAL_PURPOSE_PORT(config, m_gen_port1, msx_general_purpose_port_devices, "joystick");
MSX_GENERAL_PURPOSE_PORT(config, m_gen_port2, msx_general_purpose_port_devices, "joystick");
if (m_hw_def.has_printer_port())
{
// printer
@ -673,7 +630,6 @@ void msx_state::msx1(vdp_type vdp_type, ay8910_type ay8910_type, machine_config
msx_base(ay8910_type, config, 10.738635_MHz_XTAL, 3);
m_maincpu->set_addrmap(AS_IO, &msx_state::msx1_io_map);
m_maincpu->set_vblank_int("screen", FUNC(msx_state::msx_interrupt)); /* Needed for mouse updates */
if (vdp_type == VDP_TMS9118)
TMS9118(config, m_tms9928a, 10.738635_MHz_XTAL);

View File

@ -6,7 +6,8 @@
#pragma once
#include "bus/centronics/ctronics.h"
#include "bus/msx_slot/cartridge.h"
#include "bus/msx/ctrl/ctrl.h"
#include "bus/msx/slot/cartridge.h"
#include "cpu/z80/z80.h"
#include "imagedev/cassette.h"
#include "machine/buffer.h"
@ -68,9 +69,6 @@ protected:
void msx1(vdp_type vdp_type, ay8910_type ay8910_type, machine_config &config);
void msx1_add_softlists(machine_config &config);
template <u8 Game_port>
u8 game_port_r();
// configuration helpers
template <typename T, typename U>
auto &add_internal_slot(machine_config &config, T &&type, U &&tag, u8 prim, u8 sec, u8 page, u8 numpages)
@ -185,9 +183,8 @@ protected:
required_device<input_merger_any_high_device> m_mainirq;
required_device<screen_device> m_screen;
optional_memory_region m_region_kanji;
required_ioport_array<2> m_io_joy;
required_ioport m_io_dsw;
required_ioport_array<2> m_io_mouse;
required_device<msx_general_purpose_port_device> m_gen_port1;
required_device<msx_general_purpose_port_device> m_gen_port2;
required_ioport_array<11> m_io_key;
output_finder<2> m_leds;
msx_hw_def m_hw_def;
@ -227,13 +224,8 @@ protected:
};
std::vector<internal_slot> m_internal_slots;
INTERRUPT_GEN_MEMBER(msx_interrupt);
// PSG
u8 m_psg_b;
// mouse
u16 m_mouse[2];
s8 m_mouse_stat[2];
// kanji
u32 m_kanji_latch;
// memory

View File

@ -4,12 +4,12 @@
#include "emu.h"
#include "msx.h"
#include "msx_keyboard.h"
#include "bus/msx_slot/ax230.h"
#include "bus/msx_slot/disk.h"
#include "bus/msx_slot/msx_rs232.h"
#include "bus/msx_slot/ram.h"
#include "bus/msx_slot/ram_mm.h"
#include "bus/msx_slot/rom.h"
#include "bus/msx/slot/ax230.h"
#include "bus/msx/slot/disk.h"
#include "bus/msx/slot/msx_rs232.h"
#include "bus/msx/slot/ram.h"
#include "bus/msx/slot/ram_mm.h"
#include "bus/msx/slot/rom.h"
using namespace msx_keyboard;

View File

@ -9,9 +9,9 @@
#include "emu.h"
#include "msx.h"
#include "msx_keyboard.h"
#include "bus/msx_slot/bruc100.h"
#include "bus/msx_slot/ram.h"
#include "bus/msx_slot/ram_mm.h"
#include "bus/msx/slot/bruc100.h"
#include "bus/msx/slot/ram.h"
#include "bus/msx/slot/ram_mm.h"
using namespace msx_keyboard;

View File

@ -4,11 +4,11 @@
#include "emu.h"
#include "msx.h"
#include "msx_keyboard.h"
#include "bus/msx_slot/disk.h"
#include "bus/msx_slot/msx_rs232.h"
#include "bus/msx_slot/ram.h"
#include "bus/msx_slot/ram_mm.h"
#include "bus/msx_slot/rom.h"
#include "bus/msx/slot/disk.h"
#include "bus/msx/slot/msx_rs232.h"
#include "bus/msx/slot/ram.h"
#include "bus/msx/slot/ram_mm.h"
#include "bus/msx/slot/rom.h"
using namespace msx_keyboard;

View File

@ -8,18 +8,18 @@
#include "msx_matsushita.h"
#include "msx_s1985.h"
#include "msx_systemflags.h"
#include "bus/msx_slot/bunsetsu.h"
#include "bus/msx_slot/disk.h"
#include "bus/msx_slot/fs4600.h"
#include "bus/msx_slot/fsa1fm.h"
#include "bus/msx_slot/msx_rs232.h"
#include "bus/msx_slot/msx_write.h"
#include "bus/msx_slot/music.h"
#include "bus/msx_slot/panasonic08.h"
#include "bus/msx_slot/ram.h"
#include "bus/msx_slot/ram_mm.h"
#include "bus/msx_slot/rom.h"
#include "bus/msx_slot/sony08.h"
#include "bus/msx/slot/bunsetsu.h"
#include "bus/msx/slot/disk.h"
#include "bus/msx/slot/fs4600.h"
#include "bus/msx/slot/fsa1fm.h"
#include "bus/msx/slot/msx_rs232.h"
#include "bus/msx/slot/msx_write.h"
#include "bus/msx/slot/music.h"
#include "bus/msx/slot/panasonic08.h"
#include "bus/msx/slot/ram.h"
#include "bus/msx/slot/ram_mm.h"
#include "bus/msx/slot/rom.h"
#include "bus/msx/slot/sony08.h"
using namespace msx_keyboard;

View File

@ -6,45 +6,6 @@
namespace msx_keyboard {
static INPUT_PORTS_START(msx_dips)
PORT_START("JOY0")
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_UNUSED)
PORT_DIPNAME(0x80, 0, "Game port 1")
PORT_DIPSETTING(0x00, DEF_STR(Joystick))
PORT_DIPSETTING(0x80, "Mouse")
PORT_START("JOY1")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_DIPNAME(0x80, 0, "Game port 2")
PORT_DIPSETTING(0x00, DEF_STR(Joystick))
PORT_DIPSETTING(0x80, "Mouse")
PORT_START("DSW")
PORT_DIPNAME(0x40, 0, "Swap game port 1 and 2")
PORT_DIPSETTING(0, DEF_STR(No))
PORT_DIPSETTING(0x40, DEF_STR(Yes))
PORT_START("MOUSE0")
PORT_BIT(0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
PORT_BIT(0x00ff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
PORT_START("MOUSE1")
PORT_BIT(0xff00, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2)
PORT_BIT(0x00ff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2)
INPUT_PORTS_END
/* 2008-05 FP: About keyboards
Even if some later Philips (and maybe others) models started to use a layout similar to current
@ -171,8 +132,6 @@ INPUT_PORTS_START(msx)
PORT_START("KEY10")
PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_INCLUDE(msx_dips)
INPUT_PORTS_END