Previous 199869 Revisions Next

r29593 Sunday 13th April, 2014 at 07:43:17 UTC by Fabio Priuli
(MESS) sms: added support for Furrtek's multitap adapter (supported
by BOoM homebrew game). [Enik Land]
[src/emu/bus]bus.mak
[src/emu/bus/sms_ctrl]multitap.c* multitap.h* paddle.c rfu.c smsctrl.c smsctrl.h sports.c sportsjp.c

trunk/src/emu/bus/sms_ctrl/sportsjp.c
r29592r29593
9292   m_sports_jp_in(*this, "SPORTS_JP_IN"),
9393   m_sports_jp_x(*this, "SPORTS_JP_X"),
9494   m_sports_jp_y(*this, "SPORTS_JP_Y"),
95   m_read_state(0),
9596   m_interval(SPORTS_PAD_JP_INTERVAL)
9697{
9798}
r29592r29593
104105void sms_sports_pad_jp_device::device_start()
105106{
106107   m_start_time = machine().time();
107   m_read_state = 0;
108108
109109   save_item(NAME(m_start_time));
110110   save_item(NAME(m_read_state));
trunk/src/emu/bus/sms_ctrl/smsctrl.c
r29592r29593
120120   SLOT_INTERFACE("sportspad", SMS_SPORTS_PAD)
121121   SLOT_INTERFACE("sportspadjp", SMS_SPORTS_PAD_JP)
122122   SLOT_INTERFACE("rapidfire", SMS_RAPID_FIRE)
123   SLOT_INTERFACE("multitap", SMS_MULTITAP)
123124SLOT_INTERFACE_END
trunk/src/emu/bus/sms_ctrl/paddle.c
r29592r29593
7777   device_sms_control_port_interface(mconfig, *this),
7878   m_paddle_pins(*this, "CTRL_PORT"),
7979   m_paddle_x(*this, "PADDLE_X"),
80   m_read_state(0),
8081   m_interval(PADDLE_INTERVAL)
8182{
8283}
r29592r29593
8990void sms_paddle_device::device_start()
9091{
9192   m_start_time = machine().time();
92   m_read_state = 0;
9393
9494   save_item(NAME(m_start_time));
9595   save_item(NAME(m_read_state));
trunk/src/emu/bus/sms_ctrl/sports.c
r29592r29593
118118   m_sports_out(*this, "SPORTS_OUT"),
119119   m_sports_x(*this, "SPORTS_X"),
120120   m_sports_y(*this, "SPORTS_Y"),
121   m_read_state(0),
122   m_last_data(0),
121123   m_interval(SPORTS_PAD_INTERVAL)
122124{
123125}
r29592r29593
129131
130132void sms_sports_pad_device::device_start()
131133{
132   m_read_state = 0;
133   m_last_data = 0;
134134   m_last_time = machine().time();
135135
136136   save_item(NAME(m_read_state));
trunk/src/emu/bus/sms_ctrl/rfu.c
r29592r29593
5555   device_sms_control_port_interface(mconfig, *this),
5656   m_rfire_sw(*this, "rfu_sw"),
5757   m_subctrl_port(*this, "ctrl"),
58   m_read_state(0),
5859   m_interval(RAPID_FIRE_INTERVAL)
5960{
6061}
r29592r29593
6768void sms_rapid_fire_device::device_start()
6869{
6970   m_start_time = machine().time();
70   m_read_state = 0;
7171
7272   save_item(NAME(m_start_time));
7373   save_item(NAME(m_read_state));
trunk/src/emu/bus/sms_ctrl/smsctrl.h
r29592r29593
120120#include "sports.h"
121121#include "sportsjp.h"
122122#include "rfu.h"
123#include "multitap.h"
123124
124125SLOT_INTERFACE_EXTERN( sms_control_port_devices );
125126
trunk/src/emu/bus/sms_ctrl/multitap.c
r0r29593
1/**********************************************************************
2
3    Furrtek's homemade multitap emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "multitap.h"
11
12
13// Scheme: http://www.smspower.org/uploads/Homebrew/BOoM-SMS-sms4p_2.png
14
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type SMS_MULTITAP = &device_creator<sms_multitap_device>;
21
22
23//**************************************************************************
24//  LIVE DEVICE
25//**************************************************************************
26
27//-------------------------------------------------
28//  sms_multitap_device - constructor
29//-------------------------------------------------
30
31sms_multitap_device::sms_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
32   device_t(mconfig, SMS_MULTITAP, "Furrtek's Multitap", tag, owner, clock, "sms_multitap", __FILE__),
33   device_sms_control_port_interface(mconfig, *this),
34   m_subctrl1_port(*this, "ctrl1"),
35   m_subctrl2_port(*this, "ctrl2"),
36   m_subctrl3_port(*this, "ctrl3"),
37   m_subctrl4_port(*this, "ctrl4"),
38   m_read_state(0),
39   m_last_data(0)
40{
41}
42
43
44//-------------------------------------------------
45//  device_start - device-specific startup
46//-------------------------------------------------
47
48void sms_multitap_device::device_start()
49{
50   save_item(NAME(m_read_state));
51   save_item(NAME(m_last_data));
52
53   m_subctrl1_port->device_start();
54   m_subctrl2_port->device_start();
55   m_subctrl3_port->device_start();
56   m_subctrl4_port->device_start();
57}
58
59
60//-------------------------------------------------
61//  sms_peripheral_r - multitap read
62//-------------------------------------------------
63
64UINT8 sms_multitap_device::peripheral_r()
65{
66   UINT8 data = 0xff;
67
68   switch(m_read_state)
69   {
70   case 0:
71      data = m_subctrl1_port->port_r();
72      break;
73   case 1:
74      data = m_subctrl2_port->port_r();
75      break;
76   case 2:
77      data = m_subctrl3_port->port_r();
78      break;
79   case 3:
80      data = m_subctrl4_port->port_r();
81      break;
82   }
83
84   // force TH level high (1), as the line is not connected to subports.
85   data |= 0x40;
86
87   return data;
88}
89
90
91//-------------------------------------------------
92//  sms_peripheral_w - multitap write
93//-------------------------------------------------
94
95void sms_multitap_device::peripheral_w(UINT8 data)
96{
97   UINT8 output_data;
98
99   // check if TH level is low (0) and was high (1)
100   if (!(data & 0x40) && (m_last_data & 0x40))
101   {
102      m_read_state = (m_read_state + 1) & 3;
103   }
104   m_last_data = data;
105
106   // output default TH level (1), as the line is not connected to subports.
107   output_data = data | 0x40;
108
109   switch(m_read_state)
110   {
111   case 0:
112      m_subctrl1_port->port_w(output_data);
113      break;
114   case 1:
115      m_subctrl2_port->port_w(output_data);
116      break;
117   case 2:
118      m_subctrl3_port->port_w(output_data);
119      break;
120   case 3:
121      m_subctrl4_port->port_w(output_data);
122      break;
123   }
124}
125
126
127//-------------------------------------------------
128//  machine_config_additions - device-specific
129//  machine configurations
130//-------------------------------------------------
131
132READ32_MEMBER( sms_multitap_device::pixel_r )
133{
134   return m_port->pixel_r();
135}
136
137
138static MACHINE_CONFIG_FRAGMENT( multitap_slot )
139   // Controller subports setup, without the TH callback declaration,
140   // because the circuit scheme shows TH of subports without connection.
141   MCFG_SMS_CONTROL_PORT_ADD("ctrl1", sms_control_port_devices, "joypad")
142   MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
143   MCFG_SMS_CONTROL_PORT_ADD("ctrl2", sms_control_port_devices, "joypad")
144   MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
145   MCFG_SMS_CONTROL_PORT_ADD("ctrl3", sms_control_port_devices, "joypad")
146   MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
147   MCFG_SMS_CONTROL_PORT_ADD("ctrl4", sms_control_port_devices, "joypad")
148   MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(sms_multitap_device, pixel_r))
149MACHINE_CONFIG_END
150
151
152machine_config_constructor sms_multitap_device::device_mconfig_additions() const
153{
154   return MACHINE_CONFIG_NAME( multitap_slot );
155}
Property changes on: trunk/src/emu/bus/sms_ctrl/multitap.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/bus/sms_ctrl/multitap.h
r0r29593
1/**********************************************************************
2
3    Furrtek's homemade multitap emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SMS_MULTITAP__
13#define __SMS_MULTITAP__
14
15
16#include "emu.h"
17#include "smsctrl.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> sms_multitap_device
26
27class sms_multitap_device : public device_t,
28                     public device_sms_control_port_interface
29{
30public:
31   // construction/destruction
32   sms_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34   DECLARE_READ32_MEMBER(pixel_r);
35
36protected:
37   // device-level overrides
38   virtual void device_start();
39   virtual machine_config_constructor device_mconfig_additions() const;
40
41   // device_sms_control_port_interface overrides
42   virtual UINT8 peripheral_r();
43   virtual void peripheral_w(UINT8 data);
44
45private:
46   required_device<sms_control_port_device> m_subctrl1_port;
47   required_device<sms_control_port_device> m_subctrl2_port;
48   required_device<sms_control_port_device> m_subctrl3_port;
49   required_device<sms_control_port_device> m_subctrl4_port;
50
51   UINT8 m_read_state;
52   UINT8 m_last_data;
53};
54
55
56// device type definition
57extern const device_type SMS_MULTITAP;
58
59
60#endif
Property changes on: trunk/src/emu/bus/sms_ctrl/multitap.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/bus.mak
r29592r29593
874874BUSOBJS += $(BUSOBJ)/sms_ctrl/rfu.o
875875BUSOBJS += $(BUSOBJ)/sms_ctrl/sports.o
876876BUSOBJS += $(BUSOBJ)/sms_ctrl/sportsjp.o
877BUSOBJS += $(BUSOBJ)/sms_ctrl/multitap.o
877878endif
878879
879880#-------------------------------------------------

Previous 199869 Revisions Next


© 1997-2024 The MAME Team