mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00
(MESS) sms: added support for Furrtek's multitap adapter (supported
by BOoM homebrew game). [Enik Land]
This commit is contained in:
parent
6046351372
commit
2899527ed4
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1216,6 +1216,8 @@ src/emu/bus/sms_ctrl/joypad.c svneol=native#text/plain
|
|||||||
src/emu/bus/sms_ctrl/joypad.h svneol=native#text/plain
|
src/emu/bus/sms_ctrl/joypad.h svneol=native#text/plain
|
||||||
src/emu/bus/sms_ctrl/lphaser.c svneol=native#text/plain
|
src/emu/bus/sms_ctrl/lphaser.c svneol=native#text/plain
|
||||||
src/emu/bus/sms_ctrl/lphaser.h svneol=native#text/plain
|
src/emu/bus/sms_ctrl/lphaser.h svneol=native#text/plain
|
||||||
|
src/emu/bus/sms_ctrl/multitap.c svneol=native#text/plain
|
||||||
|
src/emu/bus/sms_ctrl/multitap.h svneol=native#text/plain
|
||||||
src/emu/bus/sms_ctrl/paddle.c svneol=native#text/plain
|
src/emu/bus/sms_ctrl/paddle.c svneol=native#text/plain
|
||||||
src/emu/bus/sms_ctrl/paddle.h svneol=native#text/plain
|
src/emu/bus/sms_ctrl/paddle.h svneol=native#text/plain
|
||||||
src/emu/bus/sms_ctrl/rfu.c svneol=native#text/plain
|
src/emu/bus/sms_ctrl/rfu.c svneol=native#text/plain
|
||||||
|
@ -874,6 +874,7 @@ BUSOBJS += $(BUSOBJ)/sms_ctrl/paddle.o
|
|||||||
BUSOBJS += $(BUSOBJ)/sms_ctrl/rfu.o
|
BUSOBJS += $(BUSOBJ)/sms_ctrl/rfu.o
|
||||||
BUSOBJS += $(BUSOBJ)/sms_ctrl/sports.o
|
BUSOBJS += $(BUSOBJ)/sms_ctrl/sports.o
|
||||||
BUSOBJS += $(BUSOBJ)/sms_ctrl/sportsjp.o
|
BUSOBJS += $(BUSOBJ)/sms_ctrl/sportsjp.o
|
||||||
|
BUSOBJS += $(BUSOBJ)/sms_ctrl/multitap.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
155
src/emu/bus/sms_ctrl/multitap.c
Normal file
155
src/emu/bus/sms_ctrl/multitap.c
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Furrtek's homemade multitap emulation
|
||||||
|
|
||||||
|
Copyright MESS Team.
|
||||||
|
Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#include "multitap.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Scheme: http://www.smspower.org/uploads/Homebrew/BOoM-SMS-sms4p_2.png
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// DEVICE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
const device_type SMS_MULTITAP = &device_creator<sms_multitap_device>;
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// LIVE DEVICE
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// sms_multitap_device - constructor
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
sms_multitap_device::sms_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||||
|
device_t(mconfig, SMS_MULTITAP, "Furrtek's Multitap", tag, owner, clock, "sms_multitap", __FILE__),
|
||||||
|
device_sms_control_port_interface(mconfig, *this),
|
||||||
|
m_subctrl1_port(*this, "ctrl1"),
|
||||||
|
m_subctrl2_port(*this, "ctrl2"),
|
||||||
|
m_subctrl3_port(*this, "ctrl3"),
|
||||||
|
m_subctrl4_port(*this, "ctrl4"),
|
||||||
|
m_read_state(0),
|
||||||
|
m_last_data(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_start - device-specific startup
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void sms_multitap_device::device_start()
|
||||||
|
{
|
||||||
|
save_item(NAME(m_read_state));
|
||||||
|
save_item(NAME(m_last_data));
|
||||||
|
|
||||||
|
m_subctrl1_port->device_start();
|
||||||
|
m_subctrl2_port->device_start();
|
||||||
|
m_subctrl3_port->device_start();
|
||||||
|
m_subctrl4_port->device_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// sms_peripheral_r - multitap read
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
UINT8 sms_multitap_device::peripheral_r()
|
||||||
|
{
|
||||||
|
UINT8 data = 0xff;
|
||||||
|
|
||||||
|
switch(m_read_state)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
data = m_subctrl1_port->port_r();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
data = m_subctrl2_port->port_r();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
data = m_subctrl3_port->port_r();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
data = m_subctrl4_port->port_r();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// force TH level high (1), as the line is not connected to subports.
|
||||||
|
data |= 0x40;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// sms_peripheral_w - multitap write
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void sms_multitap_device::peripheral_w(UINT8 data)
|
||||||
|
{
|
||||||
|
UINT8 output_data;
|
||||||
|
|
||||||
|
// check if TH level is low (0) and was high (1)
|
||||||
|
if (!(data & 0x40) && (m_last_data & 0x40))
|
||||||
|
{
|
||||||
|
m_read_state = (m_read_state + 1) & 3;
|
||||||
|
}
|
||||||
|
m_last_data = data;
|
||||||
|
|
||||||
|
// output default TH level (1), as the line is not connected to subports.
|
||||||
|
output_data = data | 0x40;
|
||||||
|
|
||||||
|
switch(m_read_state)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_subctrl1_port->port_w(output_data);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
m_subctrl2_port->port_w(output_data);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_subctrl3_port->port_w(output_data);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
m_subctrl4_port->port_w(output_data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// machine_config_additions - device-specific
|
||||||
|
// machine configurations
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
READ32_MEMBER( sms_multitap_device::pixel_r )
|
||||||
|
{
|
||||||
|
return m_port->pixel_r();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static MACHINE_CONFIG_FRAGMENT( multitap_slot )
|
||||||
|
// Controller subports setup, without the TH callback declaration,
|
||||||
|
// because the circuit scheme shows TH of subports without connection.
|
||||||
|
MCFG_SMS_CONTROL_PORT_ADD("ctrl1", sms_control_port_devices, "joypad")
|
||||||
|
MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
|
||||||
|
MCFG_SMS_CONTROL_PORT_ADD("ctrl2", sms_control_port_devices, "joypad")
|
||||||
|
MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
|
||||||
|
MCFG_SMS_CONTROL_PORT_ADD("ctrl3", sms_control_port_devices, "joypad")
|
||||||
|
MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
|
||||||
|
MCFG_SMS_CONTROL_PORT_ADD("ctrl4", sms_control_port_devices, "joypad")
|
||||||
|
MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
|
||||||
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
|
||||||
|
machine_config_constructor sms_multitap_device::device_mconfig_additions() const
|
||||||
|
{
|
||||||
|
return MACHINE_CONFIG_NAME( multitap_slot );
|
||||||
|
}
|
60
src/emu/bus/sms_ctrl/multitap.h
Normal file
60
src/emu/bus/sms_ctrl/multitap.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Furrtek's homemade multitap emulation
|
||||||
|
|
||||||
|
Copyright MESS Team.
|
||||||
|
Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __SMS_MULTITAP__
|
||||||
|
#define __SMS_MULTITAP__
|
||||||
|
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "smsctrl.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// TYPE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// ======================> sms_multitap_device
|
||||||
|
|
||||||
|
class sms_multitap_device : public device_t,
|
||||||
|
public device_sms_control_port_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
sms_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||||
|
|
||||||
|
DECLARE_READ32_MEMBER(pixel_r);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device-level overrides
|
||||||
|
virtual void device_start();
|
||||||
|
virtual machine_config_constructor device_mconfig_additions() const;
|
||||||
|
|
||||||
|
// device_sms_control_port_interface overrides
|
||||||
|
virtual UINT8 peripheral_r();
|
||||||
|
virtual void peripheral_w(UINT8 data);
|
||||||
|
|
||||||
|
private:
|
||||||
|
required_device<sms_control_port_device> m_subctrl1_port;
|
||||||
|
required_device<sms_control_port_device> m_subctrl2_port;
|
||||||
|
required_device<sms_control_port_device> m_subctrl3_port;
|
||||||
|
required_device<sms_control_port_device> m_subctrl4_port;
|
||||||
|
|
||||||
|
UINT8 m_read_state;
|
||||||
|
UINT8 m_last_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
extern const device_type SMS_MULTITAP;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -77,6 +77,7 @@ sms_paddle_device::sms_paddle_device(const machine_config &mconfig, const char *
|
|||||||
device_sms_control_port_interface(mconfig, *this),
|
device_sms_control_port_interface(mconfig, *this),
|
||||||
m_paddle_pins(*this, "CTRL_PORT"),
|
m_paddle_pins(*this, "CTRL_PORT"),
|
||||||
m_paddle_x(*this, "PADDLE_X"),
|
m_paddle_x(*this, "PADDLE_X"),
|
||||||
|
m_read_state(0),
|
||||||
m_interval(PADDLE_INTERVAL)
|
m_interval(PADDLE_INTERVAL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -89,7 +90,6 @@ sms_paddle_device::sms_paddle_device(const machine_config &mconfig, const char *
|
|||||||
void sms_paddle_device::device_start()
|
void sms_paddle_device::device_start()
|
||||||
{
|
{
|
||||||
m_start_time = machine().time();
|
m_start_time = machine().time();
|
||||||
m_read_state = 0;
|
|
||||||
|
|
||||||
save_item(NAME(m_start_time));
|
save_item(NAME(m_start_time));
|
||||||
save_item(NAME(m_read_state));
|
save_item(NAME(m_read_state));
|
||||||
|
@ -55,6 +55,7 @@ sms_rapid_fire_device::sms_rapid_fire_device(const machine_config &mconfig, cons
|
|||||||
device_sms_control_port_interface(mconfig, *this),
|
device_sms_control_port_interface(mconfig, *this),
|
||||||
m_rfire_sw(*this, "rfu_sw"),
|
m_rfire_sw(*this, "rfu_sw"),
|
||||||
m_subctrl_port(*this, "ctrl"),
|
m_subctrl_port(*this, "ctrl"),
|
||||||
|
m_read_state(0),
|
||||||
m_interval(RAPID_FIRE_INTERVAL)
|
m_interval(RAPID_FIRE_INTERVAL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -67,7 +68,6 @@ sms_rapid_fire_device::sms_rapid_fire_device(const machine_config &mconfig, cons
|
|||||||
void sms_rapid_fire_device::device_start()
|
void sms_rapid_fire_device::device_start()
|
||||||
{
|
{
|
||||||
m_start_time = machine().time();
|
m_start_time = machine().time();
|
||||||
m_read_state = 0;
|
|
||||||
|
|
||||||
save_item(NAME(m_start_time));
|
save_item(NAME(m_start_time));
|
||||||
save_item(NAME(m_read_state));
|
save_item(NAME(m_read_state));
|
||||||
|
@ -120,4 +120,5 @@ SLOT_INTERFACE_START( sms_control_port_devices )
|
|||||||
SLOT_INTERFACE("sportspad", SMS_SPORTS_PAD)
|
SLOT_INTERFACE("sportspad", SMS_SPORTS_PAD)
|
||||||
SLOT_INTERFACE("sportspadjp", SMS_SPORTS_PAD_JP)
|
SLOT_INTERFACE("sportspadjp", SMS_SPORTS_PAD_JP)
|
||||||
SLOT_INTERFACE("rapidfire", SMS_RAPID_FIRE)
|
SLOT_INTERFACE("rapidfire", SMS_RAPID_FIRE)
|
||||||
|
SLOT_INTERFACE("multitap", SMS_MULTITAP)
|
||||||
SLOT_INTERFACE_END
|
SLOT_INTERFACE_END
|
||||||
|
@ -120,6 +120,7 @@ extern const device_type SMS_CONTROL_PORT;
|
|||||||
#include "sports.h"
|
#include "sports.h"
|
||||||
#include "sportsjp.h"
|
#include "sportsjp.h"
|
||||||
#include "rfu.h"
|
#include "rfu.h"
|
||||||
|
#include "multitap.h"
|
||||||
|
|
||||||
SLOT_INTERFACE_EXTERN( sms_control_port_devices );
|
SLOT_INTERFACE_EXTERN( sms_control_port_devices );
|
||||||
|
|
||||||
|
@ -118,6 +118,8 @@ sms_sports_pad_device::sms_sports_pad_device(const machine_config &mconfig, cons
|
|||||||
m_sports_out(*this, "SPORTS_OUT"),
|
m_sports_out(*this, "SPORTS_OUT"),
|
||||||
m_sports_x(*this, "SPORTS_X"),
|
m_sports_x(*this, "SPORTS_X"),
|
||||||
m_sports_y(*this, "SPORTS_Y"),
|
m_sports_y(*this, "SPORTS_Y"),
|
||||||
|
m_read_state(0),
|
||||||
|
m_last_data(0),
|
||||||
m_interval(SPORTS_PAD_INTERVAL)
|
m_interval(SPORTS_PAD_INTERVAL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -129,8 +131,6 @@ sms_sports_pad_device::sms_sports_pad_device(const machine_config &mconfig, cons
|
|||||||
|
|
||||||
void sms_sports_pad_device::device_start()
|
void sms_sports_pad_device::device_start()
|
||||||
{
|
{
|
||||||
m_read_state = 0;
|
|
||||||
m_last_data = 0;
|
|
||||||
m_last_time = machine().time();
|
m_last_time = machine().time();
|
||||||
|
|
||||||
save_item(NAME(m_read_state));
|
save_item(NAME(m_read_state));
|
||||||
|
@ -92,6 +92,7 @@ sms_sports_pad_jp_device::sms_sports_pad_jp_device(const machine_config &mconfig
|
|||||||
m_sports_jp_in(*this, "SPORTS_JP_IN"),
|
m_sports_jp_in(*this, "SPORTS_JP_IN"),
|
||||||
m_sports_jp_x(*this, "SPORTS_JP_X"),
|
m_sports_jp_x(*this, "SPORTS_JP_X"),
|
||||||
m_sports_jp_y(*this, "SPORTS_JP_Y"),
|
m_sports_jp_y(*this, "SPORTS_JP_Y"),
|
||||||
|
m_read_state(0),
|
||||||
m_interval(SPORTS_PAD_JP_INTERVAL)
|
m_interval(SPORTS_PAD_JP_INTERVAL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -104,7 +105,6 @@ sms_sports_pad_jp_device::sms_sports_pad_jp_device(const machine_config &mconfig
|
|||||||
void sms_sports_pad_jp_device::device_start()
|
void sms_sports_pad_jp_device::device_start()
|
||||||
{
|
{
|
||||||
m_start_time = machine().time();
|
m_start_time = machine().time();
|
||||||
m_read_state = 0;
|
|
||||||
|
|
||||||
save_item(NAME(m_start_time));
|
save_item(NAME(m_start_time));
|
||||||
save_item(NAME(m_read_state));
|
save_item(NAME(m_read_state));
|
||||||
|
Loading…
Reference in New Issue
Block a user