Previous 199869 Revisions Next

r34761 Saturday 31st January, 2015 at 09:59:42 UTC by Fabio Priuli
(MESS) snes: converted input code to use slot devices. This means that you
now change the emulated controllers (Joypad, Mouse, Multitap, Super Scope)
via the Slot Device menu of the UI interface and not anymore from the System
Configurations menu. Also, changing controller now requires to reset the
system, so please take some timeto choose the desired controller *before*
starting the game, if you want to play a game that uses special controllers.
[Fabio Priuli]

(MESS) snes: fixed Mouse emulation so that it does not jump back erratically
if you keep moving beyond the window border. [Fabio Priuli]

(MESS) snes: fixed Multitap Adapter emulation so games properly recognize
the device and inputs from all 5 controllers are accepted by the games.
[Fabio Priuli]

(MESS) snes: added emulation of the Pachinko controller used by a few
pachinko games for Super Famicom. [Fabio Priuli]

(MESS) snes: added emulation of the Yonezawa Twin Tap controllers,
which allow to play with up to 8 players a quiz games for Super Famicom.
[Fabio Priuli]

(MESS) snes: added emulation of the Epoch Barcode Battler unit (even if
only as Super Famicom controller, and not as a standalone unit) which is
necessary to play Conveni Wars Barcode Battler Senki for Super Famicom.
[Fabio Priuli]
[src/emu/bus]bus.mak
[src/emu/bus/nes_ctrl]bcbattle.c bcbattle.h
[src/emu/bus/snes_ctrl]bcbattle.c* bcbattle.h* ctrl.c* ctrl.h* joypad.c* joypad.h* mouse.c* mouse.h* multitap.c* multitap.h* pachinko.c* pachinko.h* sscope.c* sscope.h* twintap.c* twintap.h*
[src/emu/video]snes_ppu.c snes_ppu.h
[src/mame/includes]snes.h
[src/mame/machine]snes.c
[src/mess]mess.mak
[src/mess/drivers]snes.c

trunk/src/emu/bus/bus.mak
r243272r243273
11341134
11351135#-------------------------------------------------
11361136#
1137#@src/emu/bus/snes_ctrl/ctrl.h,BUSES += SNES_CTRL
1138#-------------------------------------------------
1139
1140ifneq ($(filter SNES_CTRL,$(BUSES)),)
1141OBJDIRS += $(BUSOBJ)/snes_ctrl
1142BUSOBJS += $(BUSOBJ)/snes_ctrl/ctrl.o
1143BUSOBJS += $(BUSOBJ)/snes_ctrl/bcbattle.o
1144BUSOBJS += $(BUSOBJ)/snes_ctrl/joypad.o
1145BUSOBJS += $(BUSOBJ)/snes_ctrl/mouse.o
1146BUSOBJS += $(BUSOBJ)/snes_ctrl/multitap.o
1147BUSOBJS += $(BUSOBJ)/snes_ctrl/pachinko.o
1148BUSOBJS += $(BUSOBJ)/snes_ctrl/sscope.o
1149BUSOBJS += $(BUSOBJ)/snes_ctrl/twintap.o
1150endif
1151
1152#-------------------------------------------------
1153#
11371154#@src/emu/bus/vboy/slot.h,BUSES += VBOY
11381155#-------------------------------------------------
11391156ifneq ($(filter VBOY,$(BUSES)),)
trunk/src/emu/bus/nes_ctrl/bcbattle.c
r243272r243273
2020const device_type NES_BARCODE_BATTLER = &device_creator<nes_bcbattle_device>;
2121
2222
23static INPUT_PORTS_START( nes_battler )
24INPUT_PORTS_END
25
26//-------------------------------------------------
27//  input_ports - device-specific input ports
28//-------------------------------------------------
29
30ioport_constructor nes_bcbattle_device::device_input_ports() const
31{
32   return INPUT_PORTS_NAME( nes_battler );
33}
34
3523MACHINE_CONFIG_FRAGMENT( nes_battler )
3624   MCFG_BARCODE_READER_ADD("battler")
3725MACHINE_CONFIG_END
r243272r243273
4634//  device_timer - handler timer events
4735//-------------------------------------------------
4836
37// This part is the hacky replacement for the real Barcode unit [shared with SNES implementation]:
38// code periodically checks whether a new code has been scanned and it moves it to the
39// m_current_barcode array
4940void nes_bcbattle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
5041{
5142   if (id == TIMER_BATTLER)
r243272r243273
9283//-------------------------------------------------
9384
9485nes_bcbattle_device::nes_bcbattle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
95               device_t(mconfig, NES_BARCODE_BATTLER, "Epoch Barcode Battler", tag, owner, clock, "nes_bcbattle", __FILE__),
86               device_t(mconfig, NES_BARCODE_BATTLER, "Epoch Barcode Battler (FC)", tag, owner, clock, "nes_bcbattle", __FILE__),
9687               device_nes_control_port_interface(mconfig, *this),
9788               m_reader(*this, "battler")
9889{
trunk/src/emu/bus/nes_ctrl/bcbattle.h
r243272r243273
3030   // construction/destruction
3131   nes_bcbattle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3232
33   virtual ioport_constructor device_input_ports() const;
3433   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
3534   virtual machine_config_constructor device_mconfig_additions() const;
3635
trunk/src/emu/bus/snes_ctrl/bcbattle.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom - Epoch Barcode Battler
4
5    TODO: this should be actually emulated as a standalone system with
6    a few 7segments LEDs, once we get a dump of its BIOS
7    At the moment we only emulated the connection with a Super Famicom
8
9    Copyright MESS Team.
10    Visit http://mamedev.org for licensing and usage restrictions.
11
12**********************************************************************/
13
14#include "bcbattle.h"
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type SNES_BARCODE_BATTLER = &device_creator<snes_bcbattle_device>;
21
22
23MACHINE_CONFIG_FRAGMENT( snes_battler )
24   MCFG_BARCODE_READER_ADD("battler")
25MACHINE_CONFIG_END
26
27machine_config_constructor snes_bcbattle_device::device_mconfig_additions() const
28{
29   return MACHINE_CONFIG_NAME( snes_battler );
30}
31
32
33//-------------------------------------------------
34//  device_timer - handler timer events
35//-------------------------------------------------
36
37// This part is the hacky replacement for the real Barcode unit [shared with NES implementation]:
38// code periodically checks whether a new code has been scanned and it moves it to the
39// m_current_barcode array
40void snes_bcbattle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
41{
42   if (id == TIMER_BATTLER)
43   {
44      int old = m_new_code;
45      m_new_code = m_reader->get_pending_code();
46      // has something new been scanned?
47      if (old < m_new_code)
48      {
49         if (m_reader->get_byte_length() == 13)
50         {
51            for (int i = 0; i < 13; i++)
52               m_current_barcode[i] = m_reader->read_code() + '0';
53         }
54         else if (m_reader->get_byte_length() == 8)
55         {
56            for (int i = 0; i < 5; i++)
57               m_current_barcode[i] = 0x20;
58            for (int i = 5; i < 13; i++)
59               m_current_barcode[i] = m_reader->read_code() + '0';
60         }
61         // read one more, to reset the internal byte counter
62         m_reader->read_code();
63
64         // the string "SUNSOFT" is accepted as well by Barcode World
65         m_current_barcode[13] = 'E';
66         m_current_barcode[14] = 'P';
67         m_current_barcode[15] = 'O';
68         m_current_barcode[16] = 'C';
69         m_current_barcode[17] = 'H';
70         m_current_barcode[18] = 0x0d;
71         m_current_barcode[19] = 0x0a;
72         m_pending_code = 1;
73      }
74   }
75}
76
77//**************************************************************************
78//  LIVE DEVICE
79//**************************************************************************
80
81//-------------------------------------------------
82//  snes_bcbattle_device - constructor
83//-------------------------------------------------
84
85snes_bcbattle_device::snes_bcbattle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
86               device_t(mconfig, SNES_BARCODE_BATTLER, "Epoch Barcode Battler (SFC)", tag, owner, clock, "snes_bcbattle", __FILE__),
87               device_snes_control_port_interface(mconfig, *this),
88               m_reader(*this, "battler")
89{
90}
91
92
93//-------------------------------------------------
94//  device_start
95//-------------------------------------------------
96
97void snes_bcbattle_device::device_start()
98{
99   // lacking emulation of the standalone Barcode Battler, we refresh periodically the input from the reader
100   // proper emulation would have the standalone unit acknowledging that a new barcode has been scanned
101   // and sending the proper serial bits, instead of our read_current_bit() function!
102   battler_timer = timer_alloc(TIMER_BATTLER);
103   battler_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1000));
104
105   save_item(NAME(m_current_barcode));
106   save_item(NAME(m_new_code));
107   save_item(NAME(m_pending_code));
108   save_item(NAME(m_transmitting));
109   save_item(NAME(m_cur_bit));
110   save_item(NAME(m_cur_byte));
111}
112
113
114//-------------------------------------------------
115//  device_reset
116//-------------------------------------------------
117
118void snes_bcbattle_device::device_reset()
119{
120   m_pending_code = 0;
121   m_new_code = 0;
122   m_transmitting = 0;
123   m_cur_bit = 0;
124   m_cur_byte = 0;
125   memset(m_current_barcode, 0, ARRAY_LENGTH(m_current_barcode));
126}
127
128
129//-------------------------------------------------
130//  read
131//-------------------------------------------------
132
133int snes_bcbattle_device::read_current_bit()
134{
135   if (m_pending_code)
136   {
137      if (m_cur_bit < 4)
138      {
139         int bit = BIT(m_current_barcode[m_cur_byte], m_cur_bit - 1);
140         m_cur_bit++;
141         return bit;
142      }
143      if (m_cur_bit == 4)   // only the low nibble is transmitted (this is the main action of the BBII interface for SNES)
144      {
145         m_cur_bit = 0;
146         //printf("%X ", m_current_barcode[m_cur_byte]);
147         m_cur_byte++;
148         if (m_cur_byte == 13)
149         {
150            m_cur_byte = 0;
151            m_pending_code = 0;
152         }
153         return 0;
154      }
155   }
156
157   return 0;
158}
159
160
161//-------------------------------------------------
162//  poll
163//-------------------------------------------------
164
165void snes_bcbattle_device::port_poll()
166{
167   m_idx = 0;
168}
169
170
171//-------------------------------------------------
172//  read
173//-------------------------------------------------
174
175UINT8 snes_bcbattle_device::read_pin4()
176{
177   UINT8 ret = 0;
178   
179   if (m_idx >= 80)
180      ret |= 0x00;
181   else if (m_idx >= 28)   // scan actual barcode
182   {
183      ret |= read_current_bit();   // if no code is pending transmission, the function returns 0
184      m_idx++;
185   }
186   else if (m_idx >= 25)   // unknown flags?
187      m_idx++;
188   else if (m_idx == 24)   // barcode present
189   {
190      ret |= m_pending_code;
191      m_idx++;
192   }
193   else if (m_idx >= 12)   // controller ID
194      ret |= BIT(0x7000, m_idx++);
195   else   // first 12 bytes are unknown and probably always 0
196      m_idx++;
197   
198   return ret;
199}
200
201
202//-------------------------------------------------
203//  write
204//-------------------------------------------------
205
206void snes_bcbattle_device::write_strobe(UINT8 data)
207{
208   int old = m_strobe;
209   m_strobe = data & 0x01;
210   
211   if (m_strobe < old)   // 1 -> 0 transition
212      port_poll();
213}
trunk/src/emu/bus/snes_ctrl/bcbattle.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom - Epoch Barcode Battler
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SNES_BCBATTLE__
13#define __SNES_BCBATTLE__
14
15
16#include "emu.h"
17#include "ctrl.h"
18#include "machine/bcreader.h"
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> snes_bcbattle_device
25
26class snes_bcbattle_device : public device_t,
27                     public device_snes_control_port_interface
28{
29public:
30   // construction/destruction
31   snes_bcbattle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
34   virtual machine_config_constructor device_mconfig_additions() const;
35
36protected:
37   // device-level overrides
38   virtual void device_start();
39   virtual void device_reset();
40
41   virtual UINT8 read_pin4();
42   virtual void write_strobe(UINT8 data);
43   virtual void port_poll();
44
45   int read_current_bit();
46
47private:
48   
49   static const device_timer_id TIMER_BATTLER = 1;
50   required_device<barcode_reader_device> m_reader;
51   UINT8 m_current_barcode[20];
52   int m_pending_code, m_new_code, m_transmitting, m_cur_bit, m_cur_byte;
53   emu_timer *battler_timer;
54
55   int m_strobe, m_on, m_idx;
56};
57
58// device type definition
59extern const device_type SNES_BARCODE_BATTLER;
60
61#endif
trunk/src/emu/bus/snes_ctrl/ctrl.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES controller port emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "ctrl.h"
11// slot devices
12#include "bcbattle.h"
13#include "joypad.h"
14#include "mouse.h"
15#include "multitap.h"
16#include "pachinko.h"
17#include "sscope.h"
18#include "twintap.h"
19
20
21//**************************************************************************
22//  GLOBAL VARIABLES
23//**************************************************************************
24
25const device_type SNES_CONTROL_PORT = &device_creator<snes_control_port_device>;
26
27
28//**************************************************************************
29//  CARD INTERFACE
30//**************************************************************************
31
32//-------------------------------------------------
33//  device_snes_control_port_interface - constructor
34//-------------------------------------------------
35
36device_snes_control_port_interface::device_snes_control_port_interface(const machine_config &mconfig, device_t &device)
37   : device_slot_card_interface(mconfig,device)
38{
39   m_port = dynamic_cast<snes_control_port_device *>(device.owner());
40}
41
42
43//-------------------------------------------------
44//  ~device_snes_control_port_interface - destructor
45//-------------------------------------------------
46
47device_snes_control_port_interface::~device_snes_control_port_interface()
48{
49}
50
51
52//**************************************************************************
53//  LIVE DEVICE
54//**************************************************************************
55
56//-------------------------------------------------
57//  snes_control_port_device - constructor
58//-------------------------------------------------
59
60snes_control_port_device::snes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
61                  device_t(mconfig, SNES_CONTROL_PORT, "Nintendo SNES / SFC control port", tag, owner, clock, "snes_control_port", __FILE__),
62                  device_slot_interface(mconfig, *this)
63{
64}
65
66
67//-------------------------------------------------
68//  snes_control_port_device - destructor
69//-------------------------------------------------
70
71snes_control_port_device::~snes_control_port_device()
72{
73}
74
75
76//-------------------------------------------------
77//  device_start - device-specific startup
78//-------------------------------------------------
79
80void snes_control_port_device::device_start()
81{
82   m_device = dynamic_cast<device_snes_control_port_interface *>(get_card_device());
83   m_onscreen_cb.bind_relative_to(*owner());
84   m_gunlatch_cb.bind_relative_to(*owner());
85}
86
87
88UINT8 snes_control_port_device::read_pin4()
89{
90   UINT8 data = 0;
91   if (m_device)
92      data |= m_device->read_pin4();
93   return data;
94}
95
96UINT8 snes_control_port_device::read_pin5()
97{
98   UINT8 data = 0;
99   if (m_device)
100      data |= m_device->read_pin5();
101   return data;
102}
103
104void snes_control_port_device::write_strobe(UINT8 data)
105{
106   if (m_device)
107      m_device->write_strobe(data);
108}
109
110void snes_control_port_device::write_pin6(UINT8 data)
111{
112   if (m_device)
113      m_device->write_pin6(data);
114}
115
116void snes_control_port_device::port_poll()
117{
118   if (m_device)
119      m_device->port_poll();
120}
121
122
123//-------------------------------------------------
124//  SLOT_INTERFACE( snes_control_port_devices )
125//-------------------------------------------------
126
127SLOT_INTERFACE_START( snes_control_port_devices )
128   SLOT_INTERFACE("joypad", SNES_JOYPAD)
129   SLOT_INTERFACE("mouse", SNES_MOUSE)
130   SLOT_INTERFACE("multitap", SNES_MULTITAP)
131   SLOT_INTERFACE("pachinko", SNES_PACHINKO)
132   SLOT_INTERFACE("sscope", SNES_SUPERSCOPE)
133   SLOT_INTERFACE("twintap", SNES_TWINTAP)
134   SLOT_INTERFACE("barcode_battler", SNES_BARCODE_BATTLER)
135SLOT_INTERFACE_END
trunk/src/emu/bus/snes_ctrl/ctrl.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES controller port emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10
11#pragma once
12
13#ifndef __SNES_CONTROL_PORT__
14#define __SNES_CONTROL_PORT__
15
16#include "emu.h"
17
18//**************************************************************************
19//  TYPE DEFINITIONS
20//**************************************************************************
21
22class snes_control_port_device;
23
24// ======================> device_snes_control_port_interface
25
26class device_snes_control_port_interface : public device_slot_card_interface
27{
28public:
29   // construction/destruction
30   device_snes_control_port_interface(const machine_config &mconfig, device_t &device);
31   virtual ~device_snes_control_port_interface();
32   
33   virtual UINT8 read_pin4() { return 0; };
34   virtual UINT8 read_pin5() { return 0; };
35   virtual void write_pin6(UINT8 data) { };
36   virtual void write_strobe(UINT8 data) { };
37   virtual void port_poll() { };
38   
39protected:
40   snes_control_port_device *m_port;
41};
42
43typedef device_delegate<bool (INT16 x, INT16 y)> snesctrl_onscreen_delegate;
44#define SNESCTRL_ONSCREEN_CB(name)  bool name(INT16 x, INT16 y)
45
46typedef device_delegate<void (INT16 x, INT16 y)> snesctrl_gunlatch_delegate;
47#define SNESCTRL_GUNLATCH_CB(name)  void name(INT16 x, INT16 y)
48
49// ======================> snes_control_port_device
50
51class snes_control_port_device : public device_t,
52                        public device_slot_interface
53{
54public:
55   // construction/destruction
56   snes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
57   virtual ~snes_control_port_device();
58
59   static void set_onscreen_callback(device_t &device, snesctrl_onscreen_delegate callback) { downcast<snes_control_port_device &>(device).m_onscreen_cb = callback; }
60   static void set_gunlatch_callback(device_t &device, snesctrl_gunlatch_delegate callback) { downcast<snes_control_port_device &>(device).m_gunlatch_cb = callback; }
61
62   UINT8 read_pin4();
63   UINT8 read_pin5();
64   void write_pin6(UINT8 data);
65   void write_strobe(UINT8 data);
66   void port_poll();
67
68   snesctrl_onscreen_delegate m_onscreen_cb;
69   snesctrl_gunlatch_delegate m_gunlatch_cb;
70
71protected:
72   // device-level overrides
73   virtual void device_start();
74
75   device_snes_control_port_interface *m_device;
76};
77
78
79// device type definition
80extern const device_type SNES_CONTROL_PORT;
81
82
83//**************************************************************************
84//  INTERFACE CONFIGURATION MACROS
85//**************************************************************************
86
87#define MCFG_SNES_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
88   MCFG_DEVICE_ADD(_tag, SNES_CONTROL_PORT, 0) \
89   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
90
91#define MCFG_SNESCTRL_ONSCREEN_CB(_class, _method) \
92   snes_control_port_device::set_onscreen_callback(*device, snesctrl_onscreen_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
93
94#define MCFG_SNESCTRL_GUNLATCH_CB(_class, _method) \
95   snes_control_port_device::set_gunlatch_callback(*device, snesctrl_gunlatch_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
96
97
98SLOT_INTERFACE_EXTERN( snes_control_port_devices );
99
100
101#endif
trunk/src/emu/bus/snes_ctrl/joypad.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES Joypad
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "joypad.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type SNES_JOYPAD = &device_creator<snes_joypad_device>;
17
18
19static INPUT_PORTS_START( snes_joypad )
20   PORT_START("JOYPAD")
21   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
22   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Y")
23   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Select")
24   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start")
25   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
26   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
27   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
28   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
29   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
30   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("X")
31   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("L")
32   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("R")
33   PORT_BIT( 0xf000, IP_ACTIVE_HIGH, IPT_UNUSED )
34INPUT_PORTS_END
35
36
37//-------------------------------------------------
38//  input_ports - device-specific input ports
39//-------------------------------------------------
40
41ioport_constructor snes_joypad_device::device_input_ports() const
42{
43   return INPUT_PORTS_NAME( snes_joypad );
44}
45
46
47
48//**************************************************************************
49//  LIVE DEVICE
50//**************************************************************************
51
52//-------------------------------------------------
53//  snes_joypad_device - constructor
54//-------------------------------------------------
55
56snes_joypad_device::snes_joypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
57               device_t(mconfig, SNES_JOYPAD, "Nintendo SNES / SFC Control Pad", tag, owner, clock, "snes_joypad", __FILE__),
58               device_snes_control_port_interface(mconfig, *this),
59               m_joypad(*this, "JOYPAD")
60{
61}
62
63
64//-------------------------------------------------
65//  device_start - device-specific startup
66//-------------------------------------------------
67
68void snes_joypad_device::device_start()
69{
70   save_item(NAME(m_latch));
71   save_item(NAME(m_strobe));
72}
73
74
75//-------------------------------------------------
76//  device_reset - device-specific reset
77//-------------------------------------------------
78
79void snes_joypad_device::device_reset()
80{
81   m_latch = 0;
82   m_strobe = 0;
83}
84
85
86//-------------------------------------------------
87//  poll
88//-------------------------------------------------
89
90void snes_joypad_device::port_poll()
91{
92   UINT16 temp = m_joypad->read();
93   // avoid sending signals that could crash games
94   // if left, no right
95   if (temp & 0x40)
96      temp &= ~0x80;
97   // if up, no down
98   if (temp & 0x10)
99      temp &= ~0x20;
100   
101   m_latch = temp | 0xffff0000;
102}
103
104//-------------------------------------------------
105//  read
106//-------------------------------------------------
107
108UINT8 snes_joypad_device::read_pin4()
109{
110   UINT8 ret = m_latch & 1;
111   m_latch >>= 1;
112   return ret;
113}
114
115//-------------------------------------------------
116//  write
117//-------------------------------------------------
118
119void snes_joypad_device::write_strobe(UINT8 data)
120{
121   int old = m_strobe;
122   m_strobe = data & 0x01;
123
124   if (m_strobe < old)   // 1 -> 0 transition
125      port_poll();
126}
127
trunk/src/emu/bus/snes_ctrl/joypad.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES Joypad
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SNES_JOYPAD__
13#define __SNES_JOYPAD__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> snes_joypad_device
24
25class snes_joypad_device : public device_t,
26                     public device_snes_control_port_interface
27{
28public:
29   // construction/destruction
30   snes_joypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   // optional information overrides
33   virtual ioport_constructor device_input_ports() const;
34
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39
40   // device_sms_control_port_interface overrides
41   virtual UINT8 read_pin4();
42   virtual void write_strobe(UINT8 data);
43   virtual void port_poll();
44   
45private:
46   required_ioport m_joypad;
47   int m_strobe;
48   UINT32 m_latch;
49};
50
51
52// device type definition
53extern const device_type SNES_JOYPAD;
54
55
56#endif
trunk/src/emu/bus/snes_ctrl/mouse.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES Mouse
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "mouse.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type SNES_MOUSE = &device_creator<snes_mouse_device>;
17
18
19static INPUT_PORTS_START( snes_mouse )
20   PORT_START("BUTTONS")
21   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) // these must be 0!
22   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Button Right")
23   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button Left")
24   PORT_BIT( 0x0c00, IP_ACTIVE_HIGH, IPT_UNUSED ) // mouse speed: 0 = slow, 1 = normal, 2 = fast, 3 = unused
25   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNUSED )
26   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNUSED )
27   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNUSED )
28   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
29
30   // we use IPT_LIGHTGUN instead of IPT_MOUSE to avoid input to wrap when you reach the screen border
31   // due to the relative nature of movement detection in SNES mouse, when we wrap the system would
32   // detect a sudden jump in the wrong direction, making the usage unfriendly...
33   PORT_START("MOUSE_X")
34   PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_NAME("Superscope X Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
35//   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
36
37   PORT_START("MOUSE_Y")
38   PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_Y) PORT_NAME("Superscope Y Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
39//   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(30) PORT_KEYDELTA(5)
40INPUT_PORTS_END
41
42
43//-------------------------------------------------
44//  input_ports - device-specific input ports
45//-------------------------------------------------
46
47ioport_constructor snes_mouse_device::device_input_ports() const
48{
49   return INPUT_PORTS_NAME( snes_mouse );
50}
51
52
53
54//**************************************************************************
55//  LIVE DEVICE
56//**************************************************************************
57
58//-------------------------------------------------
59//  snes_mouse_device - constructor
60//-------------------------------------------------
61
62snes_mouse_device::snes_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
63               device_t(mconfig, SNES_MOUSE, "Nintendo SNES / SFC Mouse Controller", tag, owner, clock, "snes_mouse", __FILE__),
64               device_snes_control_port_interface(mconfig, *this),
65               m_buttons(*this, "BUTTONS"),
66               m_xaxis(*this, "MOUSE_X"),
67               m_yaxis(*this, "MOUSE_Y")
68{
69}
70
71
72//-------------------------------------------------
73//  device_start - device-specific startup
74//-------------------------------------------------
75
76void snes_mouse_device::device_start()
77{
78   save_item(NAME(m_strobe));
79   save_item(NAME(m_idx));
80   save_item(NAME(m_latch));
81   save_item(NAME(m_x));
82   save_item(NAME(m_y));
83   save_item(NAME(m_oldx));
84   save_item(NAME(m_oldy));
85   save_item(NAME(m_deltax));
86   save_item(NAME(m_deltay));
87   save_item(NAME(m_speed));
88   save_item(NAME(m_dirx));
89   save_item(NAME(m_diry));
90}
91
92
93//-------------------------------------------------
94//  device_reset - device-specific reset
95//-------------------------------------------------
96
97void snes_mouse_device::device_reset()
98{
99   m_strobe = 0;
100   m_idx = 0;
101   m_latch = 0;
102   m_x = 0;
103   m_y = 0;
104   m_oldx = 0;
105   m_oldy = 0;
106   m_deltax = 0;
107   m_deltay = 0;
108   m_speed = 0;
109   m_dirx = -1;
110   m_diry = -1;
111}
112
113
114//-------------------------------------------------
115//  poll
116//-------------------------------------------------
117
118void snes_mouse_device::port_poll()
119{
120   INT16 var;
121   int new_dir;
122   m_idx = 0;
123   m_latch = m_buttons->read();
124
125   m_oldx = m_x;
126   m_oldy = m_y;
127   m_x = m_xaxis->read();
128   m_y = m_yaxis->read();
129
130   var = m_x - m_oldx;
131   if (var)
132   {
133      new_dir = (var < 0) ? 1 : 0;
134      if (m_dirx != new_dir)
135         m_dirx = new_dir;
136   }
137
138   if (var < -127)
139   {
140      m_deltax = 0x7f;
141      m_oldx -= 127;
142   }
143   else if (var < 0)
144   {
145      m_deltax = -var;
146      m_oldx = m_x;
147   }
148   else if (var > 127)
149   {
150      m_deltax = 0x7f;
151      m_oldx += 127;
152   }
153   else
154   {
155      m_deltax = var;
156      m_oldx = m_x;
157   }
158   
159   var = m_y - m_oldy;
160   if (var)
161   {
162      new_dir = (var < 0) ? 1 : 0;
163      if (m_diry != new_dir)
164         m_diry = new_dir;
165   }
166   
167   if (var < -127)
168   {
169      m_deltay = 0x7f;
170      m_oldy -= 127;
171   }
172   else if (var < 0)
173   {
174      m_deltay = -var;
175      m_oldy = m_y;
176   }
177   else if (var > 127)
178   {
179      m_deltay = 0x7f;
180      m_oldy += 127;
181   }
182   else
183   {
184      m_deltay = var;
185      m_oldy = m_y;
186   }
187
188   m_deltax |= (m_dirx << 7);
189   m_deltay |= (m_diry << 7);
190}
191
192//-------------------------------------------------
193//  read
194//-------------------------------------------------
195
196UINT8 snes_mouse_device::read_pin4()
197{
198   UINT8 res = 0;
199   
200   if (m_strobe == 1)
201   {
202      // reading with strobe 1, changes mouse speed
203      m_speed = (m_speed + 1) % 3;
204      return res;
205   }
206   
207   if (m_idx >= 32)
208      res |= 0x01;
209   else if (m_idx >= 24)
210      res |= BIT(m_deltax, (31 - m_idx++));
211   else if (m_idx >= 16)
212      res |= BIT(m_deltay, (23 - m_idx++));
213   else if (m_idx == 11)
214   {
215      res |= BIT(m_speed, 0);
216      m_idx++;
217   }
218   else if (m_idx == 10)
219   {
220      res |= BIT(m_speed, 1);
221      m_idx++;
222   }
223   else
224      res |= BIT(m_latch, m_idx++);
225   
226   return res;
227}
228
229//-------------------------------------------------
230//  write
231//-------------------------------------------------
232
233void snes_mouse_device::write_strobe(UINT8 data)
234{
235   int old = m_strobe;
236   m_strobe = data & 0x01;
237
238   if (m_strobe < old)   // 1 -> 0 transition
239      port_poll();
240}
241
trunk/src/emu/bus/snes_ctrl/mouse.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES Mouse
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SNES_MOUSE__
13#define __SNES_MOUSE__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> snes_mouse_device
24
25class snes_mouse_device : public device_t,
26                     public device_snes_control_port_interface
27{
28public:
29   // construction/destruction
30   snes_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   // optional information overrides
33   virtual ioport_constructor device_input_ports() const;
34
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39
40   // device_sms_control_port_interface overrides
41   virtual UINT8 read_pin4();
42   virtual void write_strobe(UINT8 data);
43   virtual void port_poll();
44   
45private:
46   required_ioport m_buttons;
47   required_ioport m_xaxis;
48   required_ioport m_yaxis;
49   int m_strobe;
50   int m_idx;
51   UINT32 m_latch;
52
53   INT16 m_x, m_y, m_oldx, m_oldy;
54   UINT8 m_deltax, m_deltay;
55   int m_speed;
56   int m_dirx, m_diry;
57};
58
59
60// device type definition
61extern const device_type SNES_MOUSE;
62
63
64#endif
trunk/src/emu/bus/snes_ctrl/multitap.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES Multitap Adapter
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "multitap.h"
11#include "joypad.h"
12#include "twintap.h"
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type SNES_MULTITAP = &device_creator<snes_multitap_device>;
19
20
21static INPUT_PORTS_START( snes_multitap )
22   PORT_START("CONFIG")
23   PORT_CONFNAME( 0x01, 0x00, "Number of players")
24   PORT_CONFSETTING(  0x00, "3-5P" )
25   PORT_CONFSETTING(  0x01, "2P" )
26INPUT_PORTS_END
27
28
29//-------------------------------------------------
30//  input_ports - device-specific input ports
31//-------------------------------------------------
32
33ioport_constructor snes_multitap_device::device_input_ports() const
34{
35   return INPUT_PORTS_NAME( snes_multitap );
36}
37
38
39static SLOT_INTERFACE_START( snes_multitap )
40   SLOT_INTERFACE("joypad", SNES_JOYPAD)
41   SLOT_INTERFACE("twintap", SNES_TWINTAP)
42SLOT_INTERFACE_END
43
44static MACHINE_CONFIG_FRAGMENT( multi5p )
45   MCFG_SNES_CONTROL_PORT_ADD("port1", snes_multitap, "joypad")
46   MCFG_SNES_CONTROL_PORT_ADD("port2", snes_multitap, "joypad")
47   MCFG_SNES_CONTROL_PORT_ADD("port3", snes_multitap, "joypad")
48   MCFG_SNES_CONTROL_PORT_ADD("port4", snes_multitap, "joypad")
49MACHINE_CONFIG_END
50
51
52//-------------------------------------------------
53//  machine_config_additions - device-specific
54//  machine configurations
55//-------------------------------------------------
56
57machine_config_constructor snes_multitap_device::device_mconfig_additions() const
58{
59   return MACHINE_CONFIG_NAME( multi5p );
60}
61
62
63//**************************************************************************
64//  LIVE DEVICE
65//**************************************************************************
66
67//-------------------------------------------------
68//  snes_multitap_device - constructor
69//-------------------------------------------------
70
71snes_multitap_device::snes_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
72               device_t(mconfig, SNES_MULTITAP, "Nintendo SNES / SFC Multitap Adapter", tag, owner, clock, "snes_joypad", __FILE__),
73               device_snes_control_port_interface(mconfig, *this),
74               m_port1(*this, "port1"),
75               m_port2(*this, "port2"),
76               m_port3(*this, "port3"),
77               m_port4(*this, "port4"),
78               m_cfg(*this, "CONFIG")
79{
80}
81
82
83//-------------------------------------------------
84//  device_start - device-specific startup
85//-------------------------------------------------
86
87void snes_multitap_device::device_start()
88{
89   save_item(NAME(m_select));
90}
91
92void snes_multitap_device::device_reset()
93{
94   m_select = 1;
95}
96
97//-------------------------------------------------
98//  poll
99//-------------------------------------------------
100
101void snes_multitap_device::port_poll()
102{
103   m_port1->port_poll();
104   if (m_cfg->read() == 0) // 4P
105   {
106      m_port2->port_poll();
107      m_port3->port_poll();
108      m_port4->port_poll();
109   }
110}
111
112//-------------------------------------------------
113//  read
114//-------------------------------------------------
115
116UINT8 snes_multitap_device::read_pin4()
117{
118   UINT8 ret = 0;
119
120   if (m_cfg->read() == 0) // 4P
121      ret |= m_select ? m_port1->read_pin4() : m_port3->read_pin4();
122   else    // 1P
123      ret |= m_select ? m_port1->read_pin4() : 0;
124   
125   return ret;
126}
127
128UINT8 snes_multitap_device::read_pin5()
129{
130   UINT8 ret = 0;
131   
132   if (m_cfg->read() == 0) // 4P
133      ret |= m_select ? m_port2->read_pin4() : m_port4->read_pin4();
134   return ret;
135}
136
137//-------------------------------------------------
138//  write
139//-------------------------------------------------
140
141void snes_multitap_device::write_strobe(UINT8 data)
142{
143   m_port1->write_strobe(data);
144   if (m_cfg->read() == 0) // 4P
145   {
146      m_port2->write_strobe(data);
147      m_port3->write_strobe(data);
148      m_port4->write_strobe(data);
149   }
150}
151
152void snes_multitap_device::write_pin6(UINT8 data)
153{
154   m_select = data & 1;
155}
trunk/src/emu/bus/snes_ctrl/multitap.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES Multitap Adapter
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SNES_MULTITAP__
13#define __SNES_MULTITAP__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> snes_multitap_device
24
25class snes_multitap_device : public device_t,
26                     public device_snes_control_port_interface
27{
28public:
29   // construction/destruction
30   snes_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   // optional information overrides
33   virtual ioport_constructor device_input_ports() const;
34   virtual machine_config_constructor device_mconfig_additions() const;
35
36protected:
37   // device-level overrides
38   virtual void device_start();
39   virtual void device_reset();
40
41   // device_sms_control_port_interface overrides
42   virtual UINT8 read_pin4();
43   virtual UINT8 read_pin5();
44   virtual void write_strobe(UINT8 data);
45   virtual void write_pin6(UINT8 data);
46   virtual void port_poll();
47
48private:
49   required_device<snes_control_port_device> m_port1;
50   required_device<snes_control_port_device> m_port2;
51   required_device<snes_control_port_device> m_port3;
52   required_device<snes_control_port_device> m_port4;
53   required_ioport m_cfg;
54   int m_select;
55};
56
57
58// device type definition
59extern const device_type SNES_MULTITAP;
60
61
62#endif
trunk/src/emu/bus/snes_ctrl/pachinko.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom - Sunsoft Pachinko Controller
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "pachinko.h"
11
12//**************************************************************************
13//  DEVICE DEFINITIONS
14//**************************************************************************
15
16const device_type SNES_PACHINKO = &device_creator<snes_pachinko_device>;
17
18
19static INPUT_PORTS_START( snes_pachinko )
20   PORT_START("DIAL")
21   PORT_BIT( 0x7f, 0x3f, IPT_PADDLE) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CENTERDELTA(0) PORT_MINMAX(0x18,0x7f)
22
23   PORT_START("BUTTON")
24   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED)
25   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Button")
26   PORT_BIT( 0xfe00, IP_ACTIVE_HIGH, IPT_UNUSED)
27INPUT_PORTS_END
28
29
30//-------------------------------------------------
31//  input_ports - device-specific input ports
32//-------------------------------------------------
33
34ioport_constructor snes_pachinko_device::device_input_ports() const
35{
36   return INPUT_PORTS_NAME( snes_pachinko );
37}
38
39
40//**************************************************************************
41//  LIVE DEVICE
42//**************************************************************************
43
44//-------------------------------------------------
45//  snes_pachinko_device - constructor
46//-------------------------------------------------
47
48snes_pachinko_device::snes_pachinko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
49               device_t(mconfig, SNES_PACHINKO, "Sunsoft Pachinko Controller", tag, owner, clock, "snes_pachinko", __FILE__),
50               device_snes_control_port_interface(mconfig, *this),
51               m_dial(*this, "DIAL"),
52               m_button(*this, "BUTTON")
53{
54}
55
56
57//-------------------------------------------------
58//  device_start - device-specific startup
59//-------------------------------------------------
60
61void snes_pachinko_device::device_start()
62{
63   save_item(NAME(m_latch));
64   save_item(NAME(m_strobe));
65}
66
67
68//-------------------------------------------------
69//  device_reset - device-specific reset
70//-------------------------------------------------
71
72void snes_pachinko_device::device_reset()
73{
74   m_latch = 0;
75   m_strobe = 0;
76}
77
78
79//-------------------------------------------------
80//  poll
81//-------------------------------------------------
82
83void snes_pachinko_device::port_poll()
84{
85   UINT8 dial = BITSWAP8(m_dial->read() ^ 0xff,7,6,5,4,3,2,1,0);
86   m_latch = m_button->read() | (dial << 25) | 0xee7000;   // add ID
87}
88
89//-------------------------------------------------
90//  read
91//-------------------------------------------------
92
93UINT8 snes_pachinko_device::read_pin4()
94{
95   UINT8 ret = m_latch & 1;
96   m_latch >>= 1;
97   return ret;
98}
99
100//-------------------------------------------------
101//  write
102//-------------------------------------------------
103
104void snes_pachinko_device::write_strobe(UINT8 data)
105{
106   int old = m_strobe;
107   m_strobe = data & 0x01;
108   
109   if (m_strobe < old)   // 1 -> 0 transition
110      port_poll();
111}
trunk/src/emu/bus/snes_ctrl/pachinko.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom - Sunsoft Pachinko Controller
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SNES_PACHINKO__
13#define __SNES_PACHINKO__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> snes_pachinko_device
24
25class snes_pachinko_device : public device_t,
26                     public device_snes_control_port_interface
27{
28public:
29   // construction/destruction
30   snes_pachinko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   // optional information overrides
33   virtual ioport_constructor device_input_ports() const;
34
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39
40   // device_sms_control_port_interface overrides
41   virtual UINT8 read_pin4();
42   virtual void write_strobe(UINT8 data);
43   virtual void port_poll();
44
45private:
46   required_ioport m_dial;
47   required_ioport m_button;
48   int m_strobe;
49   UINT32 m_latch;
50};
51
52
53// device type definition
54extern const device_type SNES_PACHINKO;
55
56
57#endif
trunk/src/emu/bus/snes_ctrl/sscope.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES SuperScope
4
5    TODO: x,y positions are not correctly latched
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#include "sscope.h"
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type SNES_SUPERSCOPE = &device_creator<snes_sscope_device>;
19
20
21static INPUT_PORTS_START( snes_sscope )
22   PORT_START("BUTTONS")
23   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Superscope Fire")
24   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Superscope Cursor")
25   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Superscope Turbo")
26   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Superscope Pause")
27   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNUSED )
28   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )    // On-screen (handled below in port_poll)
29   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )    // Noise
30
31   PORT_START("SSX")
32   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_NAME("Superscope X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15)
33
34   PORT_START("SSY")
35   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y) PORT_NAME("Superscope Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15)
36INPUT_PORTS_END
37
38
39//-------------------------------------------------
40//  input_ports - device-specific input ports
41//-------------------------------------------------
42
43ioport_constructor snes_sscope_device::device_input_ports() const
44{
45   return INPUT_PORTS_NAME( snes_sscope );
46}
47
48
49//**************************************************************************
50//  LIVE DEVICE
51//**************************************************************************
52
53//-------------------------------------------------
54//  snes_sscope_device - constructor
55//-------------------------------------------------
56
57snes_sscope_device::snes_sscope_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58               device_t(mconfig, SNES_SUPERSCOPE, "Nintendo SNES / SFC SuperScope", tag, owner, clock, "snes_sscope", __FILE__),
59               device_snes_control_port_interface(mconfig, *this),
60               m_buttons(*this, "BUTTONS"),
61               m_xaxis(*this, "SSX"),
62               m_yaxis(*this, "SSY")
63{
64}
65
66//-------------------------------------------------
67//  device_start - device-specific startup
68//-------------------------------------------------
69
70void snes_sscope_device::device_start()
71{
72   save_item(NAME(m_strobe));
73   save_item(NAME(m_idx));
74   save_item(NAME(m_latch));
75   save_item(NAME(m_x));
76   save_item(NAME(m_y));
77   save_item(NAME(m_turbo_lock));
78   save_item(NAME(m_pause_lock));
79   save_item(NAME(m_fire_lock));
80}
81
82
83//-------------------------------------------------
84//  device_reset - device-specific reset
85//-------------------------------------------------
86
87void snes_sscope_device::device_reset()
88{
89   m_strobe = 0;
90   m_idx = 0;
91   m_latch = 0;
92   m_x = 0;
93   m_y = 0;
94   m_turbo_lock = 0;
95   m_pause_lock = 0;
96   m_fire_lock = 0;
97}
98
99
100//-------------------------------------------------
101//  poll
102//-------------------------------------------------
103
104void snes_sscope_device::port_poll()
105{
106   // first read input bits
107   UINT8 input = m_buttons->read();
108   m_x = m_xaxis->read();
109   m_y = m_yaxis->read();
110   m_idx = 0;
111
112   // then start elaborating input bits
113   // 1. only keep old turbo value
114   m_latch &= 0x04;
115   
116   // 2. set onscreen/offscreen
117   if (!m_port->m_onscreen_cb.isnull())
118      m_latch |= (m_port->m_onscreen_cb(m_x, m_y) ? 0x00 : 0x40);
119   
120   // 3. pause is a button that is always edge sensitive
121   if (BIT(input, 3) && !m_pause_lock)
122   {
123      m_latch |= 0x08;
124      m_pause_lock = 1;
125   }
126   else if (!BIT(input, 3))
127      m_pause_lock = 0;
128
129   // 4. turbo is a switch; toggle is edge sensitive
130   if (BIT(input, 2) && !m_turbo_lock)
131   {
132      m_latch ^= 0x04;
133      m_turbo_lock = 1;
134   }
135   else if (!BIT(input, 2))
136      m_turbo_lock = 0;
137   
138   // 5. cursor is a button that is always level sensitive
139   m_latch |= BIT(input, 1);
140   
141   // 6. fire is a button with two behaviors: if turbo is active, trigger is level sensitive;
142   //    otherwise it is edge sensitive
143   if (BIT(input, 0) && (BIT(m_latch, 2) || !m_fire_lock))
144   {
145      m_latch |= 0x01;
146      m_fire_lock = 1;
147   }
148   else if (!BIT(input, 0))
149      m_fire_lock = 0;
150   
151   // If we have pressed fire or cursor and we are on-screen and SuperScope is in Port2, then latch video signal.
152   // Notice that this only works in Port2 because its IOBit pin is connected to bit7 of the IO Port, while Port1
153   // has IOBit pin connected to bit6 of the IO Port, and the latter is not detected by the H/V Counters. In other
154   // words, you can connect SuperScope to Port1, but there is no way SNES could detect its on-screen position
155   if ((m_latch & 0x03) && !(m_latch & 0x40) && !m_port->m_gunlatch_cb.isnull())
156      m_port->m_gunlatch_cb(m_x, m_y);
157}
158
159//-------------------------------------------------
160//  read
161//-------------------------------------------------
162
163UINT8 snes_sscope_device::read_pin4()
164{
165   UINT8 res = 0;
166   
167   if (m_idx >= 8)   // bits 8-15 = ID = all 1s; bits >= 16 all 1s
168      res |= 0x01;
169   else
170      res |= BIT(m_latch, m_idx++);
171   
172   return res;
173}
174
175//-------------------------------------------------
176//  write
177//-------------------------------------------------
178
179void snes_sscope_device::write_strobe(UINT8 data)
180{
181   int old = m_strobe;
182   m_strobe = data & 0x01;
183
184   if (m_strobe < old)   // 1 -> 0 transition
185      port_poll();
186}
187
trunk/src/emu/bus/snes_ctrl/sscope.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom & SNES SuperScope
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SNES_SUPERSCOPE__
13#define __SNES_SUPERSCOPE__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> snes_sscope_device
24
25class snes_sscope_device : public device_t,
26                     public device_snes_control_port_interface
27{
28public:
29   // construction/destruction
30   snes_sscope_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   // optional information overrides
33   virtual ioport_constructor device_input_ports() const;
34
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39
40   // device_sms_control_port_interface overrides
41   virtual UINT8 read_pin4();
42   virtual void write_strobe(UINT8 data);
43   virtual void port_poll();
44   
45private:
46   required_ioport m_buttons;
47   required_ioport m_xaxis;
48   required_ioport m_yaxis;
49   int m_strobe, m_idx;
50   UINT32 m_latch;
51
52   INT16 m_x, m_y;
53   int m_turbo_lock, m_pause_lock, m_fire_lock;
54};
55
56
57// device type definition
58extern const device_type SNES_SUPERSCOPE;
59
60
61#endif
trunk/src/emu/bus/snes_ctrl/twintap.c
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom - Yonezawa / PartyRoom 21 Twin Tap Controller
4
5    This controller consists of two 1-button small units attached to a
6    single 7pin connector. You plug the connector to Port2 and two
7    players can compete on the quiz game (Port1 should have a joypad
8    plugged in, to start the game and browse the menus). By plugging
9    a multitap adapter to Port2, up to 4 Twin Tap controllers can be
10    attached at the same time, allowing for 8 players quiz sessions.
11 
12    Copyright MESS Team.
13    Visit http://mamedev.org for licensing and usage restrictions.
14
15**********************************************************************/
16
17#include "twintap.h"
18
19//**************************************************************************
20//  DEVICE DEFINITIONS
21//**************************************************************************
22
23const device_type SNES_TWINTAP = &device_creator<snes_twintap_device>;
24
25
26static INPUT_PORTS_START( snes_twintap )
27   PORT_START("INPUTS")
28   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Button 2")
29   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Button 1")
30   PORT_BIT( 0x8ffc, IP_ACTIVE_HIGH, IPT_UNUSED )
31   PORT_BIT( 0x7000, IP_ACTIVE_LOW, IPT_UNUSED )   // controller ID unknown
32INPUT_PORTS_END
33
34
35//-------------------------------------------------
36//  input_ports - device-specific input ports
37//-------------------------------------------------
38
39ioport_constructor snes_twintap_device::device_input_ports() const
40{
41   return INPUT_PORTS_NAME( snes_twintap );
42}
43
44
45//**************************************************************************
46//  LIVE DEVICE
47//**************************************************************************
48
49//-------------------------------------------------
50//  snes_twintap_device - constructor
51//-------------------------------------------------
52
53snes_twintap_device::snes_twintap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
54               device_t(mconfig, SNES_TWINTAP, "Yonezawa Twin Tap Controller", tag, owner, clock, "snes_twintap", __FILE__),
55               device_snes_control_port_interface(mconfig, *this),
56               m_inputs(*this, "INPUTS")
57{
58}
59
60
61//-------------------------------------------------
62//  device_start - device-specific startup
63//-------------------------------------------------
64
65void snes_twintap_device::device_start()
66{
67   save_item(NAME(m_latch));
68   save_item(NAME(m_strobe));
69}
70
71
72//-------------------------------------------------
73//  device_reset - device-specific reset
74//-------------------------------------------------
75
76void snes_twintap_device::device_reset()
77{
78   m_latch = 0;
79   m_strobe = 0;
80}
81
82
83//-------------------------------------------------
84//  poll
85//-------------------------------------------------
86
87void snes_twintap_device::port_poll()
88{
89   m_latch = m_inputs->read();
90}
91
92//-------------------------------------------------
93//  read
94//-------------------------------------------------
95
96UINT8 snes_twintap_device::read_pin4()
97{
98   UINT8 ret = m_latch & 1;
99   m_latch >>= 1;
100   return ret;
101}
102
103//-------------------------------------------------
104//  write
105//-------------------------------------------------
106
107void snes_twintap_device::write_strobe(UINT8 data)
108{
109   int old = m_strobe;
110   m_strobe = data & 0x01;
111   
112   if (m_strobe < old)   // 1 -> 0 transition
113      port_poll();
114}
trunk/src/emu/bus/snes_ctrl/twintap.h
r0r243273
1/**********************************************************************
2
3    Nintendo Super Famicom - Yonezawa / PartyRoom 21 Twin Tap Controller
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __SNES_TWINTAP__
13#define __SNES_TWINTAP__
14
15
16#include "emu.h"
17#include "ctrl.h"
18
19//**************************************************************************
20//  TYPE DEFINITIONS
21//**************************************************************************
22
23// ======================> snes_twintap_device
24
25class snes_twintap_device : public device_t,
26                     public device_snes_control_port_interface
27{
28public:
29   // construction/destruction
30   snes_twintap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   // optional information overrides
33   virtual ioport_constructor device_input_ports() const;
34
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39
40   // device_sms_control_port_interface overrides
41   virtual UINT8 read_pin4();
42   virtual void write_strobe(UINT8 data);
43   virtual void port_poll();
44
45private:
46   required_ioport m_inputs;
47   int m_strobe;
48   UINT32 m_latch;
49};
50
51
52// device type definition
53extern const device_type SNES_TWINTAP;
54
55
56#endif
trunk/src/emu/video/snes_ppu.c
r243272r243273
268268
269269   save_item(NAME(m_beam.latch_horz));
270270   save_item(NAME(m_beam.latch_vert));
271   save_item(NAME(m_beam.current_horz));
272271   save_item(NAME(m_beam.current_vert));
273272   save_item(NAME(m_beam.last_visible_line));
274273   save_item(NAME(m_beam.interlace_count));
r243272r243273
370369   m_beam.latch_vert = 0;
371370   m_beam.latch_horz = 0;
372371   m_beam.current_vert = 0;
373   m_beam.current_horz = 0;
374372   m_beam.last_visible_line = 225; /* TODO: PAL setting */
375373   m_mode = 0;
376374   m_ppu1_version = 1;  // 5C77 chip version number, read by STAT77, only '1' is known
r243272r243273
19781976static const UINT16 vram_fgr_shiftab[4] = { 0, 5, 6, 7 };
19791977
19801978// utility function - latches the H/V counters.  Used by IRQ, writes to WRIO, etc.
1981void snes_ppu_device::latch_counters()
1979void snes_ppu_device::set_latch_hv(INT16 x, INT16 y)
19821980{
1983   m_beam.current_horz = m_screen->hpos() / m_htmult;
1984   m_beam.latch_vert = m_screen->vpos();
1985   m_beam.latch_horz = m_beam.current_horz;
1981   m_beam.latch_vert = y;
1982   m_beam.latch_horz = x;
19861983   m_stat78 |= 0x40;   // indicate we latched
1987//  m_read_ophct = m_read_opvct = 0;    // clear read flags - 2009-08: I think we must clear these when STAT78 is read...
19881984
19891985//  printf("latched @ H %d V %d\n", m_beam.latch_horz, m_beam.latch_vert);
19901986}
r243272r243273
23082304            return m_ppu1_open_bus;
23092305         }
23102306      case SLHV:      /* Software latch for H/V counter */
2311         latch_counters();
2307         set_latch_hv(m_screen->hpos() / m_htmult, m_screen->vpos());
23122308         return m_openbus_cb(space, 0);       /* Return value is meaningless */
23132309
23142310      case ROAMDATA:  /* Read data from OAM (DR) */
trunk/src/emu/video/snes_ppu.h
r243272r243273
124124   {
125125      UINT16 latch_horz;
126126      UINT16 latch_vert;
127      UINT16 current_horz;
128127      UINT16 current_vert;
129128      UINT8 last_visible_line;
130129      UINT8 interlace_count;
r243272r243273
250249   inline void draw_blend(UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens);
251250   void refresh_scanline(bitmap_rgb32 &bitmap, UINT16 curline);
252251
253   void latch_counters();
252   inline INT16 current_x() { return m_screen->hpos() / m_htmult; }
253   inline INT16 current_y() { return m_screen->vpos(); }
254   void set_latch_hv(INT16 x, INT16 y);
254255   void dynamic_res_change();
255256   inline UINT32 get_vram_address();
256257   UINT8 dbg_video(UINT16 curline);
trunk/src/mame/includes/snes.h
r243272r243273
397397   void hdma_init(address_space &space);
398398   void hdma_update(address_space &space, int dma);
399399   void hirq_tick();
400   void write_joy_latch(UINT8 data);
400   virtual void write_joy_latch(UINT8 data);
401   virtual void wrio_write(UINT8 data);
401402   inline UINT8 snes_rom_access(UINT32 offset);
402403
403404   void snes_init_ram();
trunk/src/mame/machine/snes.c
r243272r243273
8787{
8888   // latch the counters and pull IRQ
8989   // (don't need to switch to the 65816 context, we don't do anything dependant on it)
90   m_ppu->latch_counters();
90   m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y());
9191   SNES_CPU_REG(TIMEUP) = 0x80;    /* Indicate that irq occurred */
9292   m_maincpu->set_input_line(G65816_LINE_IRQ, ASSERT_LINE);
9393
r243272r243273
142142      {
143143         SNES_CPU_REG(TIMEUP) = 0x80;    /* Indicate that irq occurred */
144144         // IRQ latches the counters, do it now
145         m_ppu->latch_counters();
145         m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y());
146146         m_maincpu->set_input_line(G65816_LINE_IRQ, ASSERT_LINE );
147147      }
148148   }
r243272r243273
536536         SNES_CPU_REG(NMITIMEN) = data;
537537         return;
538538      case WRIO:      /* Programmable I/O port - latches H/V counters on a 0->1 transition */
539         if (!(SNES_CPU_REG(WRIO) & 0x80) && (data & 0x80))
540         {
541            // external latch
542            m_ppu->latch_counters();
543         }
539         wrio_write(data);
544540         SNES_CPU_REG(WRIO) = data;
545541         return;
546542      case HTIMEL:    /* H-Count timer settings (low)  */
r243272r243273
611607}
612608
613609
610void snes_state::wrio_write(UINT8 data)
611{
612   if (!(SNES_CPU_REG(WRIO) & 0x80) && (data & 0x80))
613   {
614      // external latch
615      m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y());
616   }
617}
618
614619WRITE_LINE_MEMBER(snes_state::snes_extern_irq_w)
615620{
616621   m_maincpu->set_input_line(G65816_LINE_IRQ, state);
trunk/src/mess/drivers/snes.c
r243272r243273
2121    - Fix vertical mosaic effects
2222    - Add support for real CX4 and ST018 CPUs
2323    - Add support for SA-1 and SuperGB add-ons
24    - Fix mouse & superscope support
25    - Add multitap support
24    - Fix superscope support
2625    - Add support for other controllers
2726
2827***************************************************************************/
r243272r243273
3332#include "includes/snes.h"
3433#include "machine/snescx4.h"
3534
36#include "crsshair.h"
37
3835#include "bus/snes/snes_slot.h"
3936#include "bus/snes/snes_carts.h"
37#include "bus/snes_ctrl/ctrl.h"
4038
41struct snes_mouse
42{
43   INT16 x, y, oldx, oldy;
44   UINT16 buttons;
45   UINT8 deltax, deltay;
46   int speed;
47};
48
49struct snes_superscope
50{
51   INT16 x, y;
52   UINT8 buttons;
53   int turbo_lock, pause_lock, fire_lock;
54   int offscreen;
55};
56
57
5839class snes_console_state : public snes_state
5940{
6041public:
61   enum
62   {
63      TIMER_LIGHTGUN_TICK = TIMER_SNES_LAST
64   };
65
6642   snes_console_state(const machine_config &mconfig, device_type type, const char *tag)
6743         : snes_state(mconfig, type, tag)
44         , m_ctrl1(*this, "ctrl1")
45         , m_ctrl2(*this, "ctrl2")
6846         , m_cartslot(*this, "snsslot")
6947   { }
7048
r243272r243273
11088   TIMER_CALLBACK_MEMBER( lightgun_tick );
11189
11290   // input related
91   SNESCTRL_ONSCREEN_CB(onscreen_cb);
92   SNESCTRL_GUNLATCH_CB(gun_latch_cb);
11393   virtual DECLARE_WRITE8_MEMBER(io_read);
11494   virtual UINT8 oldjoy1_read(int latched);
11595   virtual UINT8 oldjoy2_read(int latched);
96   virtual void write_joy_latch(UINT8 data);
97   virtual void wrio_write(UINT8 data);
11698
117   // pad inputs
118   void input_read_joy(int port, bool multitap);
119   UINT8 input_serial_pad(int port, int latched, bool multitap);
120
121   // mouse inputs
122   void input_read_mouse(int port);
123   UINT8 input_serial_mouse(int port, int latched);
124
125   // superscope inputs
126   DECLARE_CUSTOM_INPUT_MEMBER( sscope_offscreen_input );
127   void input_read_sscope(int port);
128   UINT8 input_serial_sscope(int port, int latched);
129   void gun_latch(INT16 x, INT16 y);
130
13199   virtual void machine_start();
132100   virtual void machine_reset();
133101   int m_type;
102   required_device<snes_control_port_device> m_ctrl1;
103   required_device<snes_control_port_device> m_ctrl2;
134104   optional_device<sns_cart_slot_device> m_cartslot;
135
136protected:
137
138   snes_mouse            m_mouse[2];
139   snes_superscope       m_scope[2];
140
141   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
142105};
143106
144107
r243272r243273
10601023 *
10611024 *************************************/
10621025
1063void snes_console_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
1064{
1065   switch (id)
1066   {
1067   case TIMER_LIGHTGUN_TICK:
1068      lightgun_tick(ptr, param);
1069      break;
1070   default:
1071      snes_state::device_timer(timer, id, param, ptr);
1072      break;
1073   }
1074}
1075
1076TIMER_CALLBACK_MEMBER( snes_console_state::lightgun_tick )
1077{
1078   if ((ioport("CTRLSEL")->read() & 0x0f) == 0x03 || (ioport("CTRLSEL")->read() & 0x0f) == 0x04)   {
1079      /* enable lightpen crosshair */
1080      crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL);
1081   }
1082   else
1083   {
1084      /* disable lightpen crosshair */
1085      crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_NONE);
1086   }
1087
1088   if ((ioport("CTRLSEL")->read() & 0xf0) == 0x30 || (ioport("CTRLSEL")->read() & 0xf0) == 0x40)
1089   {
1090      /* enable lightpen crosshair */
1091      crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_ALL);
1092   }
1093   else
1094   {
1095      /* disable lightpen crosshair */
1096      crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_NONE);
1097   }
1098}
1099
1100static INPUT_PORTS_START( snes_joypads )
1101
1102   PORT_START("JOY1")
1103   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Button B") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1104   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Button Y") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1105   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1106   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("P1 Start") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1107   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1108   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1109   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1110   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1111   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Button A") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1112   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P1 Button X") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1113   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P1 Button L") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1114   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Button R") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1115   PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01)
1116
1117   PORT_START("JOY2")
1118   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Button B") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1119   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P2 Button Y") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1120   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1121   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("P2 Start") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1122   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1123   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1124   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1125   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1126   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Button A") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1127   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P2 Button X") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1128   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P2 Button L") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1129   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Button R") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1130   PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10)
1131// temp hack to share the same port both for P2 alone and P2 through MP5 adapter
1132   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Button B") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1133   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P2 Button Y") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1134   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1135   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("P2 Start") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1136   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1137   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1138   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1139   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1140   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Button A") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1141   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P2 Button X") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1142   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P2 Button L") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1143   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Button R") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1144   PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1145
1146   PORT_START("JOY3")
1147   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P3 Button B") PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1148   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P3 Button Y") PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1149   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P3 Select") PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1150   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START3 ) PORT_NAME("P3 Start") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1151   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1152   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1153   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1154   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1155   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P3 Button A") PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1156   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P3 Button X") PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1157   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P3 Button L") PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1158   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P3 Button R") PORT_PLAYER(3) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1159   PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1160
1161   PORT_START("JOY4")
1162   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P4 Button B") PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1163   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P4 Button Y") PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1164   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P4 Select") PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1165   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START4 ) PORT_NAME("P4 Start") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1166   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1167   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1168   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1169   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1170   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P4 Button A") PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1171   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P4 Button X") PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1172   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P4 Button L") PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1173   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P4 Button R") PORT_PLAYER(4) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1174   PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1175
1176   PORT_START("JOY5")
1177   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P5 Button B") PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1178   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P5 Button Y") PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1179   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("P5 Select") PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1180   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START5 ) PORT_NAME("P5 Start") PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1181   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1182   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1183   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1184   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1185   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P5 Button A") PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1186   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P5 Button X") PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1187   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P5 Button L") PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1188   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P5 Button R") PORT_PLAYER(5) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1189   PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x50)
1190
1191INPUT_PORTS_END
1192
1193static INPUT_PORTS_START( snes_mouse )
1194   PORT_START("MOUSE1")
1195   /* bits 0,3 = mouse signature (must be 1) */
1196   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
1197   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED )
1198   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED )
1199   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED )
1200   /* bits 4,5 = mouse speed: 0 = slow, 1 = normal, 2 = fast, 3 = unused */
1201   PORT_BIT( 0x0030, IP_ACTIVE_HIGH, IPT_UNUSED )
1202   /* bits 6,7 = mouse buttons */
1203   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Mouse Button Left") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02)
1204   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Mouse Button Right") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02)
1205   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) // these must be 0!
1206
1207   PORT_START("MOUSE1_X")
1208   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02)
1209
1210   PORT_START("MOUSE1_Y")
1211   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02)
1212
1213   PORT_START("MOUSE2")
1214   /* bits 0,3 = mouse signature (must be 1) */
1215   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
1216   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
1217   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
1218   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
1219   /* bits 4,5 = mouse speed: 0 = slow, 1 = normal, 2 = fast, 3 = unused */
1220   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNUSED )
1221   /* bits 6,7 = mouse buttons */
1222   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Mouse Button Left") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20)
1223   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Mouse Button Right") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20)
1224
1225   PORT_START("MOUSE2_X")
1226   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20)
1227
1228   PORT_START("MOUSE2_Y")
1229   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x20)
1230INPUT_PORTS_END
1231
1232static INPUT_PORTS_START( snes_superscope )
1233   PORT_START("SUPERSCOPE1")
1234   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )    // Noise
1235   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snes_console_state, sscope_offscreen_input, (void *)0)
1236   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
1237   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
1238   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Port1 Superscope Pause") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03)
1239   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Port1 Superscope Turbo") PORT_TOGGLE PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03)
1240   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Port1 Superscope Cursor") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03)
1241   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Port1 Superscope Fire") PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03)
1242
1243   PORT_START("SUPERSCOPE1_X")
1244   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_NAME("Port1 Superscope X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03)
1245
1246   PORT_START("SUPERSCOPE1_Y")
1247   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y) PORT_NAME("Port1 Superscope Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03)
1248
1249   PORT_START("SUPERSCOPE2")
1250   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )    // Noise
1251   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snes_console_state, sscope_offscreen_input, (void *)1)
1252   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
1253   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
1254   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Port2 Superscope Pause") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30)
1255   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Port2 Superscope Turbo") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30)
1256   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Port2 Superscope Cursor") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30)
1257   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Port2 Superscope Fire") PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30)
1258
1259   PORT_START("SUPERSCOPE2_X")
1260   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_NAME("Port2 Superscope X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30)
1261
1262   PORT_START("SUPERSCOPE2_Y")
1263   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y) PORT_NAME("Port2 Superscope Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30)
1264INPUT_PORTS_END
1265
12661026static INPUT_PORTS_START( snes )
1267   PORT_START("CTRLSEL")  /* Select Controller Type */
1268   PORT_CONFNAME( 0x0f, 0x01, "P1 Controller")
1269   PORT_CONFSETTING(  0x00, "Unconnected" )
1270   PORT_CONFSETTING(  0x01, "Gamepad" )
1271   PORT_CONFSETTING(  0x02, "Mouse" )
1272   PORT_CONFSETTING(  0x03, "Superscope" )
1273//  PORT_CONFSETTING(  0x04, "Justfier" )
1274//  PORT_CONFSETTING(  0x05, "Multitap" )
1275   PORT_CONFNAME( 0xf0, 0x10, "P2 Controller")
1276   PORT_CONFSETTING(  0x00, "Unconnected" )
1277   PORT_CONFSETTING(  0x10, "Gamepad" )
1278   PORT_CONFSETTING(  0x20, "Mouse" )
1279   PORT_CONFSETTING(  0x30, "Superscope" )
1280//  PORT_CONFSETTING(  0x40, "Justfier" )
1281   PORT_CONFSETTING(  0x50, "Multitap" )
1282
1283   PORT_INCLUDE(snes_joypads)
1284   PORT_INCLUDE(snes_mouse)
1285   PORT_INCLUDE(snes_superscope)
1286
1027   // input devices go through slot options
12871028   PORT_START("OPTIONS")
12881029   PORT_CONFNAME( 0x01, 0x00, "Hi-Res pixels blurring (TV effect)")
12891030   PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r243272r243273
13491090 *
13501091 *************************************/
13511092
1352// Mouse handling
1353
1354void snes_console_state::input_read_mouse(int port)
1093WRITE8_MEMBER(snes_console_state::io_read)
13551094{
1356   INT16 var;
1357   static const char *const portnames[2][3] =
1095   // is automatic reading on? if so, read 16bits from oldjoy1/2
1096   if (SNES_CPU_REG(NMITIMEN) & 1)
13581097   {
1359      { "MOUSE1", "MOUSE1_X", "MOUSE1_Y" },
1360      { "MOUSE2", "MOUSE2_X", "MOUSE2_Y" },
1361   };
1098      UINT16 joy1 = 0, joy2 = 0, joy3 = 0, joy4 = 0;
1099      m_ctrl1->port_poll();
1100      m_ctrl2->port_poll();
1101     
1102      for (int i = 0; i < 16; i++)
1103      {
1104         joy1 |= ((m_ctrl1->read_pin4() & 1) << (15 - i));
1105         joy2 |= ((m_ctrl2->read_pin4() & 1) << (15 - i));
1106         joy3 |= ((m_ctrl1->read_pin5() & 1) << (15 - i));
1107         joy4 |= ((m_ctrl2->read_pin5() & 1) << (15 - i));
1108      }
13621109
1363   m_mouse[port].buttons = ioport(portnames[port][0])->read();
1364   m_mouse[port].x = ioport(portnames[port][1])->read();
1365   m_mouse[port].y = ioport(portnames[port][2])->read();
1110      SNES_CPU_REG(JOY1L) = (joy1 & 0x00ff) >> 0;
1111      SNES_CPU_REG(JOY1H) = (joy1 & 0xff00) >> 8;
1112      SNES_CPU_REG(JOY2L) = (joy2 & 0x00ff) >> 0;
1113      SNES_CPU_REG(JOY2H) = (joy2 & 0xff00) >> 8;
1114      SNES_CPU_REG(JOY3L) = (joy3 & 0x00ff) >> 0;
1115      SNES_CPU_REG(JOY3H) = (joy3 & 0xff00) >> 8;
1116      SNES_CPU_REG(JOY4L) = (joy4 & 0x00ff) >> 0;
1117      SNES_CPU_REG(JOY4H) = (joy4 & 0xff00) >> 8;
1118   }     
1119}
13661120
1367   var = m_mouse[port].x - m_mouse[port].oldx;
1368
1369   if (var < -127)
1370   {
1371      m_mouse[port].deltax = 0xff;
1372      m_mouse[port].oldx -= 127;
1373   }
1374   else if (var < 0)
1375   {
1376      m_mouse[port].deltax = 0x80 | (-var);
1377      m_mouse[port].oldx = m_mouse[port].x;
1378   }
1379   else if (var > 127)
1380   {
1381      m_mouse[port].deltax = 0x7f;
1382      m_mouse[port].oldx += 127;
1383   }
1384   else
1385   {
1386      m_mouse[port].deltax = var & 0xff;
1387      m_mouse[port].oldx = m_mouse[port].x;
1388   }
1389
1390   var = m_mouse[port].y - m_mouse[port].oldy;
1391
1392   if (var < -127)
1393   {
1394      m_mouse[port].deltay = 0xff;
1395      m_mouse[port].oldy -= 127;
1396   }
1397   else if (var < 0)
1398   {
1399      m_mouse[port].deltay = 0x80 | (-var);
1400      m_mouse[port].oldy = m_mouse[port].y;
1401   }
1402   else if (var > 127)
1403   {
1404      m_mouse[port].deltay = 0x7f;
1405      m_mouse[port].oldy += 127;
1406   }
1407   else
1408   {
1409      m_mouse[port].deltay = var & 0xff;
1410      m_mouse[port].oldy = m_mouse[port].y;
1411   }
1412
1413   m_data1[port] = m_mouse[port].buttons;
1414   m_data2[port] = 0;
1121UINT8 snes_console_state::oldjoy1_read(int latched)
1122{
1123   UINT8 ret = 0;
1124   ret |= m_ctrl1->read_pin4();
1125   ret |= (m_ctrl1->read_pin5() << 1);
1126   return ret;
14151127}
14161128
1417UINT8 snes_console_state::input_serial_mouse(int port, int latched)
1129UINT8 snes_console_state::oldjoy2_read(int latched)
14181130{
1419   UINT8 res = 0;
1131   UINT8 ret = 0;
1132   ret |= m_ctrl2->read_pin4();
1133   ret |= (m_ctrl2->read_pin5() << 1);
1134   return ret;
1135}
14201136
1421   if (latched)
1422   {
1423      m_mouse[port].speed = (m_mouse[port].speed + 1) % 3;
1424      return res;
1425   }
1426
1427   if (m_read_idx[port] >= 32)
1428      res |= 0x01;
1429   else if (m_read_idx[port] >= 24)
1430      res |= (m_mouse[port].deltax >> (31 - m_read_idx[port]++)) & 0x01;
1431   else if (m_read_idx[port] >= 16)
1432      res |= (m_mouse[port].deltay >> (23 - m_read_idx[port]++)) & 0x01;
1433   else if (m_read_idx[port] == 11)
1434   {
1435      res |= (m_mouse[port].speed >> 0) & 0x01;
1436      m_read_idx[port]++;
1437   }
1438   else if (m_read_idx[port] == 10)
1439   {
1440      res |= (m_mouse[port].speed >> 1) & 0x01;
1441      m_read_idx[port]++;
1442   }
1443   else
1444      res |= (m_mouse[port].buttons >> (15 - m_read_idx[port]++)) & 0x01;
1445
1446   return res;
1137void snes_console_state::write_joy_latch(UINT8 data)
1138{
1139   m_ctrl1->write_strobe(data);
1140   m_ctrl2->write_strobe(data);
14471141}
14481142
1449// Superscope handling
1450
1451CUSTOM_INPUT_MEMBER( snes_console_state::sscope_offscreen_input )
1143void snes_console_state::wrio_write(UINT8 data)
14521144{
1453   int port = (FPTR)param;
1454   static const char *const portnames[2][3] =
1145   if (!(SNES_CPU_REG(WRIO) & 0x80) && (data & 0x80))
14551146   {
1456      { "SUPERSCOPE1", "SUPERSCOPE1_X", "SUPERSCOPE1_Y" },
1457      { "SUPERSCOPE2", "SUPERSCOPE2_X", "SUPERSCOPE2_Y" },
1458   };
1147      // external latch
1148      m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y());
1149   }
14591150
1460   INT16 x = ioport(portnames[port][1])->read();
1461   INT16 y = ioport(portnames[port][2])->read();
1151   m_ctrl1->write_pin6(BIT(data, 6));
1152   m_ctrl2->write_pin6(BIT(data, 7));
14621153
1463   /* these are the theoretical boundaries, but we currently are always onscreen... */
1464   if (x < 0 || x >= SNES_SCR_WIDTH || y < 0 || y >= m_ppu->m_beam.last_visible_line)
1465      m_scope[port].offscreen = 1;
1466   else
1467      m_scope[port].offscreen = 0;
1468
1469   return m_scope[port].offscreen;
14701154}
14711155
1472
1473void snes_console_state::gun_latch(INT16 x, INT16 y)
1156SNESCTRL_GUNLATCH_CB(snes_console_state::gun_latch_cb)
14741157{
1475   /* these are the theoretical boundaries */
1158   // these are the theoretical boundaries
14761159   if (x < 0)
14771160      x = 0;
14781161   if (x > (SNES_SCR_WIDTH - 1))
14791162      x = SNES_SCR_WIDTH - 1;
1480
1163   
14811164   if (y < 0)
14821165      y = 0;
14831166   if (y > (m_ppu->m_beam.last_visible_line - 1))
14841167      y = m_ppu->m_beam.last_visible_line - 1;
14851168
1486   m_ppu->m_beam.latch_horz = x;
1487   m_ppu->m_beam.latch_vert = y;
1488   m_ppu->m_stat78 |= 0x40;
1169//   m_ppu->set_latch_hv(x, y);   // it would be more accurate to write twice to WRIO register, first with bit7 = 0 and then with bit7 = 1
1170   m_ppu->set_latch_hv(m_ppu->current_x(), m_ppu->current_y());
14891171}
14901172
1491void snes_console_state::input_read_sscope(int port)
1173SNESCTRL_ONSCREEN_CB(snes_console_state::onscreen_cb)
14921174{
1493   static const char *const portnames[2][3] =
1494   {
1495      { "SUPERSCOPE1", "SUPERSCOPE1_X", "SUPERSCOPE1_Y" },
1496      { "SUPERSCOPE2", "SUPERSCOPE2_X", "SUPERSCOPE2_Y" },
1497   };
1498   UINT8 input;
1499
1500   /* first read input bits */
1501   m_scope[port].x = ioport(portnames[port][1])->read();
1502   m_scope[port].y = ioport(portnames[port][2])->read();
1503   input = ioport(portnames[port][0])->read();
1504
1505   /* then start elaborating input bits: only keep old turbo value */
1506   m_scope[port].buttons &= 0x20;
1507
1508   /* set onscreen/offscreen */
1509   m_scope[port].buttons |= BIT(input, 1);
1510
1511   /* turbo is a switch; toggle is edge sensitive */
1512   if (BIT(input, 5) && !m_scope[port].turbo_lock)
1513   {
1514      m_scope[port].buttons ^= 0x20;
1515      m_scope[port].turbo_lock = 1;
1516   }
1517   else if (!BIT(input, 5))
1518      m_scope[port].turbo_lock = 0;
1519
1520   /* fire is a button; if turbo is active, trigger is level sensitive; otherwise it is edge sensitive */
1521   if (BIT(input, 7) && (BIT(m_scope[port].buttons, 5) || !m_scope[port].fire_lock))
1522   {
1523      m_scope[port].buttons |= 0x80;
1524      m_scope[port].fire_lock = 1;
1525   }
1526   else if (!BIT(input, 7))
1527      m_scope[port].fire_lock = 0;
1528
1529   /* cursor is a button; it is always level sensitive */
1530   m_scope[port].buttons |= BIT(input, 6);
1531
1532   /* pause is a button; it is always edge sensitive */
1533   if (BIT(input, 4) && !m_scope[port].pause_lock)
1534   {
1535      m_scope[port].buttons |= 0x10;
1536      m_scope[port].pause_lock = 1;
1537   }
1538   else if (!BIT(input, 4))
1539      m_scope[port].pause_lock = 0;
1540
1541   /* If we have pressed fire or cursor and we are on-screen and SuperScope is in Port2, then latch video signal.
1542    Notice that we only latch Port2 because its IOBit pin is connected to bit7 of the IO Port, while Port1 has
1543    IOBit pin connected to bit6 of the IO Port, and the latter is not detected by the H/V Counters. In other
1544    words, you can connect SuperScope to Port1, but there is no way SNES could detect its on-screen position */
1545   if ((m_scope[port].buttons & 0xc0) && !(m_scope[port].buttons & 0x02) && port == 1)
1546      gun_latch(m_scope[port].x, m_scope[port].y);
1547
1548   m_data1[port] = 0xff | (m_scope[port].buttons << 8);
1549   m_data2[port] = 0;
1550}
1551
1552UINT8 snes_console_state::input_serial_sscope(int port, int latched)
1553{
1554   UINT8 res = 0;
1555
1556   if (m_read_idx[port] >= 8)
1557      res |= 0x01;
1175   // these are the theoretical boundaries, but we currently are always onscreen due to the
1176   // way IPT_LIGHTGUNs work... investigate more on this!
1177   if (x < 0 || x >= SNES_SCR_WIDTH || y < 0 || y >= m_ppu->m_beam.last_visible_line)
1178      return false;
15581179   else
1559      res |= (m_scope[port].buttons >> (7 - m_read_idx[port]++)) & 0x01;
1560
1561   return res;
1180      return true;
15621181}
15631182
1564// Joypad + Multitap handling
1565// input_read_joy is used both for standard joys and for the MP5 multitap
15661183
1567void snes_console_state::input_read_joy( int port, bool multitap )
1568{
1569   static const char *const portnames[4][2] =
1570         {
1571            { "JOY1", "JOY3" },
1572            { "JOY2", "JOY3" },
1573            { "JOY4", "JOY5" },
1574            { "JOY4", "JOY5" }
1575         };
1576
1577   if (!multitap)
1578   {
1579      m_data1[port] = ioport(portnames[port][0])->read();
1580      m_data2[port] = 0;
1581      // avoid sending signals that could crash games
1582      // if left, no right
1583      if (m_data1[port] & 0x200)
1584         m_data1[port] &= ~0x100;
1585      // if up, no down
1586      if (m_data1[port] & 0x800)
1587         m_data1[port] &= ~0x400;
1588      // if left, no right
1589      if (m_data2[port] & 0x200)
1590         m_data2[port] &= ~0x100;
1591      // if up, no down
1592      if (m_data2[port] & 0x800)
1593         m_data2[port] &= ~0x400;
1594   }
1595   else
1596   {
1597      m_data1[port] = ioport(portnames[port][0])->read();
1598      m_data2[port] = ioport(portnames[port][1])->read();
1599      m_data1[port + 2] = ioport(portnames[port + 2][0])->read();
1600      m_data2[port + 2] = ioport(portnames[port + 2][1])->read();
1601      // avoid sending signals that could crash games
1602      // if left, no right
1603      if (m_data1[port] & 0x200)
1604         m_data1[port] &= ~0x100;
1605      // if up, no down
1606      if (m_data1[port] & 0x800)
1607         m_data1[port] &= ~0x400;
1608      // if left, no right
1609      if (m_data2[port] & 0x200)
1610         m_data2[port] &= ~0x100;
1611      // if up, no down
1612      if (m_data2[port] & 0x800)
1613         m_data2[port] &= ~0x400;
1614      // if left, no right
1615      if (m_data1[port + 2] & 0x200)
1616         m_data1[port + 2] &= ~0x100;
1617      // if up, no down
1618      if (m_data1[port + 2] & 0x800)
1619         m_data1[port + 2] &= ~0x400;
1620      // if left, no right
1621      if (m_data2[port + 2] & 0x200)
1622         m_data2[port + 2] &= ~0x100;
1623      // if up, no down
1624      if (m_data2[port + 2] & 0x800)
1625         m_data2[port + 2] &= ~0x400;
1626   }
1627}
1628
1629UINT8 snes_console_state::input_serial_pad(int port, int latched, bool multitap)
1630{
1631   UINT8 res = 0;
1632
1633   // multitap signature? Super Bomberman 3-5 do not like this at all...
1634   if (multitap)
1635      res |= 2;
1636   if (latched)
1637      return res;
1638
1639   if (!multitap)
1640   {
1641      if (m_read_idx[port] >= 16)
1642         res |= 0x01;
1643      else
1644      {
1645         res |= (BIT(m_data1[port], (15 - m_read_idx[port])));
1646         res |= (BIT(m_data2[port], (15 - m_read_idx[port])) << 1);
1647         m_read_idx[port]++;
1648      }
1649   }
1650   else
1651   {
1652      int shift = !(SNES_CPU_REG(WRIO) & 0x80) ? 2 : 0;
1653      if (m_read_idx[port + shift] >= 16)
1654         res |= 0x03;
1655      else
1656      {
1657         res |= (BIT(m_data1[port + shift], (15 - m_read_idx[port + shift])));
1658         res |= (BIT(m_data2[port + shift], (15 - m_read_idx[port + shift])) << 1);
1659         m_read_idx[port + shift]++;
1660      }
1661   }
1662   return res;
1663}
1664
1665
1666// input handling from the system side
1667
1668WRITE8_MEMBER(snes_console_state::io_read)
1669{
1670   UINT8 ctrl1 = ioport("CTRLSEL")->read() & 0x0f;
1671   UINT8 ctrl2 = (ioport("CTRLSEL")->read() & 0xf0) >> 4;
1672   bool multitap0 = FALSE;
1673   bool multitap1 = FALSE;
1674
1675   // Check if lightgun has been chosen as input: if so, enable crosshair
1676   timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
1677
1678   switch (ctrl1)
1679   {
1680      case 1: // SNES joypad
1681         input_read_joy(0, FALSE);
1682         break;
1683      case 2: // SNES Mouse
1684         input_read_mouse(0);
1685         break;
1686      case 3: // SNES Superscope
1687         input_read_sscope(0);
1688         break;
1689      case 5: // SNES joypad(s) through MP5 multitap
1690         input_read_joy(0, TRUE);
1691         multitap0 = TRUE;
1692         break;
1693      case 0: // empty port1
1694      default:
1695         m_data1[0] = 0;
1696         m_data2[0] = 0;
1697         break;
1698   }
1699
1700   switch (ctrl2)
1701   {
1702      case 1: // SNES joypad
1703         input_read_joy(1, FALSE);
1704         break;
1705      case 2: // SNES Mouse
1706         input_read_mouse(1);
1707         break;
1708      case 3: // SNES Superscope
1709         input_read_sscope(1);
1710         break;
1711      case 5: // SNES joypad(s) through MP5 multitap
1712         input_read_joy(1, TRUE);
1713         multitap1 = TRUE;
1714         break;
1715      case 0: // empty port2
1716      default:
1717         m_data1[1] = 0;
1718         m_data2[1] = 0;
1719         break;
1720   }
1721
1722   // is automatic reading on? if so, copy port data1/data2 to joy1l->joy4h
1723   // this actually works like reading the first 16bits from oldjoy1/2 in reverse order
1724   if (SNES_CPU_REG(NMITIMEN) & 1)
1725   {
1726      int shift0 = (multitap0 && !(SNES_CPU_REG(WRIO) & 0x80)) ? 2 : 0;
1727      int shift1 = (multitap1 && !(SNES_CPU_REG(WRIO) & 0x80)) ? 2 : 0;
1728
1729      SNES_CPU_REG(JOY1L) = (m_data1[0 + shift0] & 0x00ff) >> 0;
1730      SNES_CPU_REG(JOY1H) = (m_data1[0 + shift0] & 0xff00) >> 8;
1731      SNES_CPU_REG(JOY2L) = (m_data1[1 + shift1] & 0x00ff) >> 0;
1732      SNES_CPU_REG(JOY2H) = (m_data1[1 + shift1] & 0xff00) >> 8;
1733      SNES_CPU_REG(JOY3L) = (m_data2[0 + shift0] & 0x00ff) >> 0;
1734      SNES_CPU_REG(JOY3H) = (m_data2[0 + shift0] & 0xff00) >> 8;
1735      SNES_CPU_REG(JOY4L) = (m_data2[1 + shift1] & 0x00ff) >> 0;
1736      SNES_CPU_REG(JOY4H) = (m_data2[1 + shift1] & 0xff00) >> 8;
1737
1738      // make sure read_idx starts returning all 1s because the auto-read reads it :-)
1739      m_read_idx[0 + shift0] = 16;
1740      m_read_idx[1 + shift1] = 16;
1741   }
1742}
1743
1744UINT8 snes_console_state::oldjoy1_read(int latched)
1745{
1746   UINT8 ctrl1 = ioport("CTRLSEL")->read() & 0x0f;
1747
1748   switch (ctrl1)
1749   {
1750      case 1: // SNES joypad
1751         return input_serial_pad(0, latched, FALSE);
1752
1753      case 2: // SNES Mouse
1754         return input_serial_mouse(0, latched);
1755
1756      case 3: // SNES Superscope
1757         return input_serial_sscope(0, latched);
1758
1759      case 5: // SNES multipad
1760         return input_serial_pad(0, latched, TRUE);
1761
1762      case 0: // empty port1
1763      default:
1764         return 0;
1765   }
1766}
1767
1768UINT8 snes_console_state::oldjoy2_read(int latched)
1769{
1770   UINT8 ctrl2 = (ioport("CTRLSEL")->read() & 0xf0) >> 4;
1771
1772   switch (ctrl2)
1773   {
1774      case 1: // SNES joypad
1775         return input_serial_pad(1, latched, FALSE);
1776
1777      case 2: // SNES Mouse
1778         return input_serial_mouse(1, latched);
1779
1780      case 3: // SNES Superscope
1781         return input_serial_sscope(1, latched);
1782
1783      case 5: // SNES multipad
1784         return input_serial_pad(1, latched, TRUE);
1785
1786      case 0: // empty port1
1787      default:
1788         return 0;
1789   }
1790}
1791
17921184/*************************************
17931185 *
17941186 *  Machine driver
r243272r243273
19141306         break;
19151307   }
19161308
1917   for (int i = 0; i < 2; i++)
1918   {
1919      save_item(NAME(m_mouse[i].x), i);
1920      save_item(NAME(m_mouse[i].oldx), i);
1921      save_item(NAME(m_mouse[i].y), i);
1922      save_item(NAME(m_mouse[i].oldy), i);
1923      save_item(NAME(m_mouse[i].buttons), i);
1924      save_item(NAME(m_mouse[i].deltax), i);
1925      save_item(NAME(m_mouse[i].deltay), i);
1926      save_item(NAME(m_mouse[i].speed), i);
1927      save_item(NAME(m_scope[i].x), i);
1928      save_item(NAME(m_scope[i].y), i);
1929      save_item(NAME(m_scope[i].buttons), i);
1930      save_item(NAME(m_scope[i].turbo_lock), i);
1931      save_item(NAME(m_scope[i].pause_lock), i);
1932      save_item(NAME(m_scope[i].fire_lock), i);
1933      save_item(NAME(m_scope[i].offscreen), i);
1934   }
1935
19361309   if (m_cartslot)
19371310      m_cartslot->save_ram();
19381311}
r243272r243273
19641337   MCFG_SNES_PPU_OPENBUS_CB(READ8(snes_state, snes_open_bus_r))
19651338   MCFG_VIDEO_SET_SCREEN("screen")
19661339
1340   MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad")
1341   MCFG_SNESCTRL_ONSCREEN_CB(snes_console_state, onscreen_cb)
1342   MCFG_SNES_CONTROL_PORT_ADD("ctrl2", snes_control_port_devices, "joypad")
1343   MCFG_SNESCTRL_ONSCREEN_CB(snes_console_state, onscreen_cb)
1344   MCFG_SNESCTRL_GUNLATCH_CB(snes_console_state, gun_latch_cb)
1345
19671346   /* sound hardware */
19681347   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
19691348   MCFG_SOUND_ADD("spc700", SNES, 0)
trunk/src/mess/mess.mak
r243272r243273
635635BUSES += SMS_CTRL
636636BUSES += SMS_EXP
637637BUSES += SNES
638BUSES += SNES_CTRL
638639BUSES += SPC1000
639640BUSES += TI99PEB
640641BUSES += TVC


Previous 199869 Revisions Next


© 1997-2024 The MAME Team