From f87d24a4a28fe93bb0cb602448bc2c1ae5325f11 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 17 Dec 2022 07:21:59 +1100 Subject: bus/msx/ctrl: Added Konami Hyper Shot controller. --- scripts/src/bus.lua | 2 + src/devices/bus/msx/ctrl/ctrl.cpp | 2 + src/devices/bus/msx/ctrl/hypershot.cpp | 85 ++++++++++++++++++++++++++++++++ src/devices/bus/msx/ctrl/hypershot.h | 19 +++++++ src/devices/bus/sms_ctrl/controllers.cpp | 11 ++++- src/devices/bus/sms_ctrl/controllers.h | 2 +- src/mame/sega/mdconsole.cpp | 5 -- src/mame/sega/puckpkmn.cpp | 39 ++++++++------- 8 files changed, 139 insertions(+), 26 deletions(-) create mode 100644 src/devices/bus/msx/ctrl/hypershot.cpp create mode 100644 src/devices/bus/msx/ctrl/hypershot.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 610e15de431..6c570865c64 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1825,6 +1825,8 @@ 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/hypershot.cpp", + MAME_DIR .. "src/devices/bus/msx/ctrl/hypershot.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/libbler.cpp", diff --git a/src/devices/bus/msx/ctrl/ctrl.cpp b/src/devices/bus/msx/ctrl/ctrl.cpp index 200c36bdd44..e2981e1adc0 100644 --- a/src/devices/bus/msx/ctrl/ctrl.cpp +++ b/src/devices/bus/msx/ctrl/ctrl.cpp @@ -9,6 +9,7 @@ #include "emu.h" #include "ctrl.h" +#include "hypershot.h" #include "joystick.h" #include "libbler.h" #include "mouse.h" @@ -43,6 +44,7 @@ void msx_general_purpose_port_device::device_start() void msx_general_purpose_port_devices(device_slot_interface &device) { + device.option_add("hypershot", MSX_HYPERSHOT); device.option_add("joystick", MSX_JOYSTICK); device.option_add("libbler", MSX_LIBBLERPAD); device.option_add("martypad", MSX_MARTYPAD); diff --git a/src/devices/bus/msx/ctrl/hypershot.cpp b/src/devices/bus/msx/ctrl/hypershot.cpp new file mode 100644 index 00000000000..f14f25c237e --- /dev/null +++ b/src/devices/bus/msx/ctrl/hypershot.cpp @@ -0,0 +1,85 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/********************************************************************** + + Konami JE 502/JE 503 Hyper Shot emulation + + Very simple controller with two buttons. RUN is connected to + both right and down, and JUMP is connected to TL. Symmetrical + case allows use with either button to the left. Pin 8 is used + as the common pin so it will work with Sega and Atari consoles. + It will work with MSX computers provided pin 8 is pulled low. + + Known versions: + * JE 502 original Japanese version, metal case + * JE 503 cost-reduced Japanese version, plastic case + * JE 503-X02 cost-reduced export version, plastic case + +**********************************************************************/ + +#include "emu.h" +#include "hypershot.h" + + +namespace { + +INPUT_PORTS_START(hypershot) + PORT_START("BUTTONS") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("%p Run") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("%p Jump") +INPUT_PORTS_END + + +class hypershot_device : public device_t, public device_msx_general_purpose_port_interface +{ +public: + hypershot_device(machine_config const &mconfig, char const *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 ioport_constructor device_input_ports() const override { return INPUT_PORTS_NAME(hypershot); } + +private: + required_ioport m_buttons; + + u8 m_pin8_in; +}; + +hypershot_device::hypershot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) + : device_t(mconfig, MSX_HYPERSHOT, tag, owner, clock) + , device_msx_general_purpose_port_interface(mconfig, *this) + , m_buttons(*this, "BUTTONS") + , m_pin8_in(1) +{ +} + +u8 hypershot_device::read() +{ + if (m_pin8_in) + { + return 0xff; + } + else + { + u8 const inputs = m_buttons->read(); + return 0xe5 | (BIT(inputs, 1) << 4) | (BIT(inputs, 0) ? 0x0a : 0x00); + } +} + +void hypershot_device::pin_8_w(int state) +{ + m_pin8_in = state ? 1 : 0; +} + +void hypershot_device::device_start() +{ + save_item(NAME(m_pin8_in)); +} + +} // anonymous namespace + + +DEFINE_DEVICE_TYPE_PRIVATE(MSX_HYPERSHOT, device_msx_general_purpose_port_interface, hypershot_device, "msx_hypershot", "Konami Hyper Shot (JE 502/JE 503, MSX)") diff --git a/src/devices/bus/msx/ctrl/hypershot.h b/src/devices/bus/msx/ctrl/hypershot.h new file mode 100644 index 00000000000..dad0ef8891c --- /dev/null +++ b/src/devices/bus/msx/ctrl/hypershot.h @@ -0,0 +1,19 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/********************************************************************** + + Konami JE 502/JE 503 Hyper Shot emulation + +**********************************************************************/ + +#ifndef MAME_BUS_MSX_CTRL_HYPERSHOT_H +#define MAME_BUS_MSX_CTRL_HYPERSHOT_H + +#pragma once + +#include "ctrl.h" + + +DECLARE_DEVICE_TYPE(MSX_HYPERSHOT, device_msx_general_purpose_port_interface) + +#endif // MAME_BUS_MSX_CTRL_HYPERSHOT_H diff --git a/src/devices/bus/sms_ctrl/controllers.cpp b/src/devices/bus/sms_ctrl/controllers.cpp index 4323b3a2bb9..b7c6057684a 100644 --- a/src/devices/bus/sms_ctrl/controllers.cpp +++ b/src/devices/bus/sms_ctrl/controllers.cpp @@ -2,7 +2,14 @@ // copyright-holders:Vas Crabb /********************************************************************** - Sega DE-9 controllers + Sega 9-pin controllers + + Unemulated Mega Drive peripherals: + * Mega Modem (connects to EXP port on Mega Drive) + * Sega Menacer (infrared wireless lightgun) + * Konami Justifier (dual wired lightguns) + * Dempa XE-1AP (3-axis analog "Cyber Stick" pad) + * EA 4-Play (impractical - connects to both CTRL1 and CTRL2) **********************************************************************/ @@ -65,5 +72,5 @@ void sms_control_port_devices(device_slot_interface &device) void sms_control_port_passive_devices(device_slot_interface &device) { - device.option_add(SMS_CTRL_OPTION_JOYPAD, SMS_JOYPAD); + device.option_add(SMS_CTRL_OPTION_JOYPAD, SMS_JOYPAD); } diff --git a/src/devices/bus/sms_ctrl/controllers.h b/src/devices/bus/sms_ctrl/controllers.h index fb3cd5c0dda..d4f92beef09 100644 --- a/src/devices/bus/sms_ctrl/controllers.h +++ b/src/devices/bus/sms_ctrl/controllers.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb /********************************************************************** - Sega DE-9 controllers + Sega 9-pin controllers **********************************************************************/ #ifndef MAME_BUS_SMS_CTRL_CONTROLLERS_H diff --git a/src/mame/sega/mdconsole.cpp b/src/mame/sega/mdconsole.cpp index e17aea2e3ed..9fb34c85a6e 100644 --- a/src/mame/sega/mdconsole.cpp +++ b/src/mame/sega/mdconsole.cpp @@ -57,11 +57,6 @@ void md_cons_state::md_exp_port(machine_config &config) static INPUT_PORTS_START( md ) - // Unemulated controllers: - // Sega Menacer - // Konami Justifier - // EA 4-Play - PORT_START("RESET") // Buttons on Mega Drive console PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?) INPUT_PORTS_END diff --git a/src/mame/sega/puckpkmn.cpp b/src/mame/sega/puckpkmn.cpp index e2f056624f4..5f9b70100db 100644 --- a/src/mame/sega/puckpkmn.cpp +++ b/src/mame/sega/puckpkmn.cpp @@ -107,9 +107,9 @@ private: }; -/* Puckman Pockimon Input Ports */ +// Puckman Pockimon Input Ports INPUT_PORTS_START( puckpkmn ) - PORT_START("P2") /* $700011.b */ + PORT_START("P2") // $700011.b PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) @@ -119,7 +119,7 @@ INPUT_PORTS_START( puckpkmn ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_START("P1") /* $700013.b */ + PORT_START("P1") // $700013.b PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) @@ -129,9 +129,9 @@ INPUT_PORTS_START( puckpkmn ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_START("UNK") /* $700015.b */ + PORT_START("UNK") // $700015.b - PORT_START("DSW1") /* $700017.b */ + PORT_START("DSW1") // $700017.b PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPSETTING( 0x03, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) @@ -156,7 +156,7 @@ INPUT_PORTS_START( puckpkmn ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_START("DSW2") /* $700019.b */ + PORT_START("DSW2") // $700019.b PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) @@ -182,10 +182,9 @@ INPUT_PORTS_START( puckpkmn ) INPUT_PORTS_END - - +// Juézhàn Tiānhuáng inputs INPUT_PORTS_START( jzth ) - PORT_START("P2") /* $700011.b */ + PORT_START("P2") // $700011.b PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) @@ -195,7 +194,7 @@ INPUT_PORTS_START( jzth ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) - PORT_START("P1") /* $700013.b */ + PORT_START("P1") // $700013.b PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) @@ -205,7 +204,7 @@ INPUT_PORTS_START( jzth ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) - PORT_START("UNK") /* $700015.b */ + PORT_START("UNK") // $700015.b PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -216,7 +215,7 @@ INPUT_PORTS_START( jzth ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("DSW1") /* $700017.b */ + PORT_START("DSW1") // $700017.b PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPSETTING( 0x03, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) @@ -241,7 +240,7 @@ INPUT_PORTS_START( jzth ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_START("DSW2") /* $700019.b */ + PORT_START("DSW2") // $700019.b PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) @@ -326,7 +325,7 @@ void jzth_state::jzth_map(address_map &map) } -// jzth protection +// Juezhan Tiānhuáng protection void jzth_state::bl_710000_w(offs_t offset, uint16_t data, uint16_t mem_mask) { // protection value is read from 0x710000 after a series of writes.. and stored at ff0007 @@ -455,7 +454,7 @@ void jzth_state::machine_start() } -/* Genie's Hardware (contains no real sega parts) */ +/* Genie's Hardware (contains no real Sega parts) */ /*************************************************************************** Puckman Pokemon Genie 2000 @@ -523,7 +522,6 @@ PUCKPOKE.U8 27C4001---/ ROM sockets U63 & U64 empty - ****************************************************************************/ void puckpkmn_state::init_puckpkmn() @@ -543,7 +541,9 @@ void puckpkmn_state::init_puckpkmn() m_vdp->set_total_scanlines(262); } -ROM_START( puckpkmn ) /* Puckman Pockimon (c)2000 Genie */ + +// Puckman Pockimon (c)2000 Genie +ROM_START( puckpkmn ) ROM_REGION( 0x400000, "maincpu", 0 ) ROM_LOAD16_BYTE( "puckpoke.u5", 0x000000, 0x080000, CRC(fd334b91) SHA1(cf8bf6645a4082ea4392937e169b1686c9c7e246) ) ROM_LOAD16_BYTE( "puckpoke.u4", 0x000001, 0x080000, CRC(839cc76b) SHA1(e15662a7175db7a8e222dda176a8ed92e0d56e9d) ) @@ -554,8 +554,10 @@ ROM_START( puckpkmn ) /* Puckman Pockimon (c)2000 Genie */ ROM_LOAD( "puckpoke.u3", 0x00000, 0x40000, CRC(7b066bac) SHA1(429616e21c672b07e0705bc63234249cac3af56f) ) ROM_END + /* 精靈家族/Jīnglíng Jiāzú (Traditional Chinese) +(c)2000 IBS Co. Ltd PCB Layout @@ -595,7 +597,7 @@ Notes: */ -ROM_START( puckpkmna ) /* Puckman Pockimon (c)2000 IBS Co. Ltd */ +ROM_START( puckpkmna ) ROM_REGION( 0x400000, "maincpu", 0 ) ROM_LOAD16_BYTE( "b2.u59", 0x000000, 0x080000, CRC(3fbea2c7) SHA1(89f3770ae92c62714f0795ddd2f311a9532eb25a) ) // FIRST AND SECOND HALF IDENTICAL ROM_IGNORE(0x080000) @@ -611,6 +613,7 @@ ROM_START( puckpkmna ) /* Puckman Pockimon (c)2000 IBS Co. Ltd */ ROM_END +// Puckman Pockimon (c)2000 Sun Mixing ROM_START( puckpkmnb ) ROM_REGION( 0x400000, "maincpu", 0 ) ROM_LOAD16_BYTE( "200061.u5", 0x000000, 0x080000, CRC(502a5093) SHA1(6dc1c79d52ebb653cb2e4388f74fd975ec323566) ) -- cgit v1.2.3