Previous 199869 Revisions Next

r31754 Sunday 24th August, 2014 at 08:42:23 UTC by Fabio Priuli
I had to split this commit in two pieces because "svn move" does not like when you move a folder
and then you add a new folder with the original name of the one you moved. the tree will compile
again with next commit. nw.
[src/emu/bus]vcs vcs_ctrl*
[src/emu/bus/plus4]sid.h
[src/mess]mess.mak
[src/mess/includes]c128.h c64.h cbm2.h plus4.h vic10.h vic20.h

trunk/src/emu/bus/vcs_ctrl/paddles.c
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System analog paddles emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#include "paddles.h"
13
14
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type VCS_PADDLES = &device_creator<vcs_paddles_device>;
21
22
23static INPUT_PORTS_START( vcs_paddles )
24   PORT_START("JOY")
25   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
26   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
27   PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED )
28
29   PORT_START("POTX")
30   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(1) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255)
31
32   PORT_START("POTY")
33   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(2) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255)
34INPUT_PORTS_END
35
36
37//-------------------------------------------------
38//  input_ports - device-specific input ports
39//-------------------------------------------------
40
41ioport_constructor vcs_paddles_device::device_input_ports() const
42{
43   return INPUT_PORTS_NAME( vcs_paddles );
44}
45
46
47
48//**************************************************************************
49//  LIVE DEVICE
50//**************************************************************************
51
52//-------------------------------------------------
53//  vcs_paddles_device - constructor
54//-------------------------------------------------
55
56vcs_paddles_device::vcs_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
57   device_t(mconfig, VCS_PADDLES, "Digital paddles", tag, owner, clock, "vcs_paddles", __FILE__),
58   device_vcs_control_port_interface(mconfig, *this),
59   m_joy(*this, "JOY"),
60   m_potx(*this, "POTX"),
61   m_poty(*this, "POTY")
62{
63}
64
65
66//-------------------------------------------------
67//  device_start - device-specific startup
68//-------------------------------------------------
69
70void vcs_paddles_device::device_start()
71{
72}
73
74
75//-------------------------------------------------
76//  vcs_joy_r - joystick read
77//-------------------------------------------------
78
79UINT8 vcs_paddles_device::vcs_joy_r()
80{
81   return m_joy->read();
82}
83
84
85//-------------------------------------------------
86//  vcs_pot_x_r - potentiometer X read
87//-------------------------------------------------
88
89UINT8 vcs_paddles_device::vcs_pot_x_r()
90{
91   return m_potx->read();
92}
93
94
95//-------------------------------------------------
96//  vcs_pot_y_r - potentiometer Y read
97//-------------------------------------------------
98
99UINT8 vcs_paddles_device::vcs_pot_y_r()
100{
101   return m_poty->read();
102}
Property changes on: trunk/src/emu/bus/vcs_ctrl/paddles.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/keypad.c
r0r31754
1/**********************************************************************
2
3    Atari Video Computer System keypad emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "keypad.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type VCS_KEYPAD = &device_creator<vcs_keypad_device>;
19
20
21static INPUT_PORTS_START( vcs_keypad )
22   PORT_START("KEYPAD")
23   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 1") PORT_CODE(KEYCODE_7_PAD)
24   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 2") PORT_CODE(KEYCODE_8_PAD)
25   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 3") PORT_CODE(KEYCODE_9_PAD)
26   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 4") PORT_CODE(KEYCODE_4_PAD)
27   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 5") PORT_CODE(KEYCODE_5_PAD)
28   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 6") PORT_CODE(KEYCODE_6_PAD)
29   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 7") PORT_CODE(KEYCODE_1_PAD)
30   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 8") PORT_CODE(KEYCODE_2_PAD)
31   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 9") PORT_CODE(KEYCODE_3_PAD)
32   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad *") PORT_CODE(KEYCODE_0_PAD)
33   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad 0") PORT_CODE(KEYCODE_DEL_PAD)
34   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("keypad #") PORT_CODE(KEYCODE_ENTER_PAD)
35INPUT_PORTS_END
36
37
38//-------------------------------------------------
39//  input_ports - device-specific input ports
40//-------------------------------------------------
41
42ioport_constructor vcs_keypad_device::device_input_ports() const
43{
44   return INPUT_PORTS_NAME( vcs_keypad );
45}
46
47
48
49//**************************************************************************
50//  LIVE DEVICE
51//**************************************************************************
52
53//-------------------------------------------------
54//  vcs_keypad_device - constructor
55//-------------------------------------------------
56
57vcs_keypad_device::vcs_keypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
58   device_t(mconfig, VCS_KEYPAD, "Keypad", tag, owner, clock, "vcs_keypad", __FILE__),
59   device_vcs_control_port_interface(mconfig, *this),
60   m_keypad(*this, "KEYPAD")
61{
62}
63
64
65//-------------------------------------------------
66//  device_start - device-specific startup
67//-------------------------------------------------
68
69void vcs_keypad_device::device_start()
70{
71   m_column = 0;
72   save_item(NAME(m_column));
73}
74
75
76//-------------------------------------------------
77//  vcs_joy_w - joystick write
78//-------------------------------------------------
79
80UINT8 vcs_keypad_device::vcs_joy_r()
81{
82   for ( int i = 0; i < 4; i++ )
83   {
84      if ( ! ( ( m_column >> i ) & 0x01 ) )
85      {
86         if ( ( m_keypad->read() >> 3*i ) & 0x04 )
87         {
88            return 0xff;
89         }
90         else
91         {
92            return 0;
93         }
94      }
95   }
96   return 0xff;
97}
98
99void vcs_keypad_device::vcs_joy_w( UINT8 data )
100{
101   m_column = data & 0x0F;
102}
103
104UINT8 vcs_keypad_device::vcs_pot_x_r()
105{
106   for ( int i = 0; i < 4; i++ )
107   {
108      if ( ! ( ( m_column >> i ) & 0x01 ) )
109      {
110         if ( ( m_keypad->read() >> 3*i ) & 0x01 )
111         {
112            return 0;
113         }
114         else
115         {
116            return 0xff;
117         }
118      }
119   }
120   return 0;
121}
122
123UINT8 vcs_keypad_device::vcs_pot_y_r()
124{
125   for ( int i = 0; i < 4; i++ )
126   {
127      if ( ! ( ( m_column >> i ) & 0x01 ) )
128      {
129         if ( ( m_keypad->read() >> 3*i ) & 0x02 )
130         {
131            return 0;
132         }
133         else
134         {
135            return 0xff;
136         }
137      }
138   }
139   return 0;
140}
Property changes on: trunk/src/emu/bus/vcs_ctrl/keypad.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/joybooster.c
r0r31754
1/**********************************************************************
2
3    Atari Video Computer System digital joystick emulation with
4    boostergrip adapter
5
6    Copyright MESS Team.
7    Visit http://mamedev.org for licensing and usage restrictions.
8
9**********************************************************************/
10
11#include "joybooster.h"
12
13
14
15//**************************************************************************
16//  DEVICE DEFINITIONS
17//**************************************************************************
18
19const device_type VCS_JOYSTICK_BOOSTER = &device_creator<vcs_joystick_booster_device>;
20
21
22static INPUT_PORTS_START( vcs_joystick_booster )
23   PORT_START("JOY")
24   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY       // Pin 1
25   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY     // Pin 2
26   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY     // Pin 3
27   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY    // Pin 4
28   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )                     // Pin 6
29   PORT_BIT( 0xd0, IP_ACTIVE_LOW, IPT_UNUSED )
30
31   // Pin 5
32   PORT_START("POTX")
33   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_BUTTON2 )
34
35   // Pin 9
36   PORT_START("POTY")
37   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_BUTTON3 )
38INPUT_PORTS_END
39
40
41//-------------------------------------------------
42//  input_ports - device-specific input ports
43//-------------------------------------------------
44
45ioport_constructor vcs_joystick_booster_device::device_input_ports() const
46{
47   return INPUT_PORTS_NAME( vcs_joystick_booster );
48}
49
50
51
52//**************************************************************************
53//  LIVE DEVICE
54//**************************************************************************
55
56//-------------------------------------------------
57//  vcs_joystick_booster_device - constructor
58//-------------------------------------------------
59
60vcs_joystick_booster_device::vcs_joystick_booster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
61   device_t(mconfig, VCS_JOYSTICK_BOOSTER, "Digital joystick with Boostergrip", tag, owner, clock, "vcs_joystick_booster", __FILE__),
62   device_vcs_control_port_interface(mconfig, *this),
63   m_joy(*this, "JOY"),
64   m_potx(*this, "POTX"),
65   m_poty(*this, "POTY")
66{
67}
68
69
70//-------------------------------------------------
71//  device_start - device-specific startup
72//-------------------------------------------------
73
74void vcs_joystick_booster_device::device_start()
75{
76}
77
78
79//-------------------------------------------------
80//  vcs_joy_r - joystick read
81//-------------------------------------------------
82
83UINT8 vcs_joystick_booster_device::vcs_joy_r()
84{
85   return m_joy->read();
86}
87
88UINT8 vcs_joystick_booster_device::vcs_pot_x_r()
89{
90   return m_potx->read();
91}
92
93UINT8 vcs_joystick_booster_device::vcs_pot_y_r()
94{
95   return m_poty->read();
96}
Property changes on: trunk/src/emu/bus/vcs_ctrl/joybooster.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/joystick.c
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System digital joystick emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#include "joystick.h"
13
14
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type VCS_JOYSTICK = &device_creator<vcs_joystick_device>;
21
22
23static INPUT_PORTS_START( vcs_joystick )
24   PORT_START("JOY")
25   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
26   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
27   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
28   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
29   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
30   PORT_BIT( 0xd0, IP_ACTIVE_LOW, IPT_UNUSED )
31INPUT_PORTS_END
32
33
34//-------------------------------------------------
35//  input_ports - device-specific input ports
36//-------------------------------------------------
37
38ioport_constructor vcs_joystick_device::device_input_ports() const
39{
40   return INPUT_PORTS_NAME( vcs_joystick );
41}
42
43
44
45//**************************************************************************
46//  LIVE DEVICE
47//**************************************************************************
48
49//-------------------------------------------------
50//  vcs_joystick_device - constructor
51//-------------------------------------------------
52
53vcs_joystick_device::vcs_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
54   device_t(mconfig, VCS_JOYSTICK, "Digital joystick", tag, owner, clock, "vcs_joystick", __FILE__),
55   device_vcs_control_port_interface(mconfig, *this),
56   m_joy(*this, "JOY")
57{
58}
59
60
61//-------------------------------------------------
62//  device_start - device-specific startup
63//-------------------------------------------------
64
65void vcs_joystick_device::device_start()
66{
67}
68
69
70//-------------------------------------------------
71//  vcs_joy_r - joystick read
72//-------------------------------------------------
73
74UINT8 vcs_joystick_device::vcs_joy_r()
75{
76   return m_joy->read();
77}
Property changes on: trunk/src/emu/bus/vcs_ctrl/joystick.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/lightpen.h
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System lightpen emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#pragma once
13
14#ifndef __VCS_LIGHTPEN__
15#define __VCS_LIGHTPEN__
16
17#include "emu.h"
18#include "ctrl.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> vcs_lightpen_device
27
28class vcs_lightpen_device : public device_t,
29                     public device_vcs_control_port_interface
30{
31public:
32   // construction/destruction
33   vcs_lightpen_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual ioport_constructor device_input_ports() const;
37
38   DECLARE_INPUT_CHANGED_MEMBER( trigger );
39
40protected:
41   // device-level overrides
42   virtual void device_start();
43
44   // device_vcs_control_port_interface overrides
45   virtual UINT8 vcs_joy_r();
46
47private:
48   required_ioport m_joy;
49   required_ioport m_lightx;
50   required_ioport m_lighty;
51};
52
53
54// device type definition
55extern const device_type VCS_LIGHTPEN;
56
57
58#endif
Property changes on: trunk/src/emu/bus/vcs_ctrl/lightpen.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/paddles.h
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System analog paddles emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#pragma once
13
14#ifndef __VCS_PADDLES__
15#define __VCS_PADDLES__
16
17#include "emu.h"
18#include "ctrl.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> vcs_paddles_device
27
28class vcs_paddles_device : public device_t,
29                     public device_vcs_control_port_interface
30{
31public:
32   // construction/destruction
33   vcs_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual ioport_constructor device_input_ports() const;
37
38protected:
39   // device-level overrides
40   virtual void device_start();
41
42   // device_vcs_control_port_interface overrides
43   virtual UINT8 vcs_joy_r();
44   virtual UINT8 vcs_pot_x_r();
45   virtual UINT8 vcs_pot_y_r();
46
47   virtual bool has_pot_x() { return true; }
48   virtual bool has_pot_y() { return true; }
49
50private:
51   required_ioport m_joy;
52   required_ioport m_potx;
53   required_ioport m_poty;
54};
55
56
57// device type definition
58extern const device_type VCS_PADDLES;
59
60
61#endif
Property changes on: trunk/src/emu/bus/vcs_ctrl/paddles.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/keypad.h
r0r31754
1/**********************************************************************
2
3    Atari Video Computer System Keypad emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __VCS_KEYPAD__
13#define __VCS_KEYPAD__
14
15#include "emu.h"
16#include "ctrl.h"
17
18
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> vcs_keypad_device
25
26class vcs_keypad_device : public device_t,
27                     public device_vcs_control_port_interface
28{
29public:
30   // construction/destruction
31   vcs_keypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   // optional information overrides
34   virtual ioport_constructor device_input_ports() const;
35
36protected:
37   // device-level overrides
38   virtual void device_start();
39
40   // device_vcs_control_port_interface overrides
41   virtual UINT8 vcs_joy_r();
42   virtual void vcs_joy_w( UINT8 data );
43   virtual UINT8 vcs_pot_x_r();
44   virtual UINT8 vcs_pot_y_r();
45
46   virtual bool has_pot_x() { return true; }
47   virtual bool has_pot_y() { return true; }
48
49private:
50   required_ioport m_keypad;
51
52   UINT8   m_column;
53};
54
55
56// device type definition
57extern const device_type VCS_KEYPAD;
58
59
60#endif
Property changes on: trunk/src/emu/bus/vcs_ctrl/keypad.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/ctrl.c
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System controller port emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#include "ctrl.h"
13
14
15
16//**************************************************************************
17//  DEVICE DEFINITION
18//**************************************************************************
19
20const device_type VCS_CONTROL_PORT = &device_creator<vcs_control_port_device>;
21
22
23
24//**************************************************************************
25//  CARD INTERFACE
26//**************************************************************************
27
28//-------------------------------------------------
29//  device_vcs_control_port_interface - constructor
30//-------------------------------------------------
31
32device_vcs_control_port_interface::device_vcs_control_port_interface(const machine_config &mconfig, device_t &device) :
33   device_slot_card_interface(mconfig, device)
34{
35   m_port = dynamic_cast<vcs_control_port_device *>(device.owner());
36}
37
38
39
40//**************************************************************************
41//  LIVE DEVICE
42//**************************************************************************
43
44//-------------------------------------------------
45//  vcs_control_port_device - constructor
46//-------------------------------------------------
47
48vcs_control_port_device::vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
49   device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock, "vcs_control_port", __FILE__),
50   device_slot_interface(mconfig, *this),
51   m_write_trigger(*this)
52{
53}
54
55
56//-------------------------------------------------
57//  device_start - device-specific startup
58//-------------------------------------------------
59
60void vcs_control_port_device::device_start()
61{
62   m_device = dynamic_cast<device_vcs_control_port_interface *>(get_card_device());
63
64   m_write_trigger.resolve_safe();
65}
66
67
68//-------------------------------------------------
69//  SLOT_INTERFACE( vcs_control_port_devices )
70//-------------------------------------------------
71
72#include "joybooster.h"
73#include "joystick.h"
74#include "keypad.h"
75#include "lightpen.h"
76#include "paddles.h"
77#include "wheel.h"
78
79SLOT_INTERFACE_START( vcs_control_port_devices )
80   SLOT_INTERFACE("joy", VCS_JOYSTICK)
81   SLOT_INTERFACE("pad", VCS_PADDLES)
82   SLOT_INTERFACE("lp", VCS_LIGHTPEN)
83   SLOT_INTERFACE("joybstr", VCS_JOYSTICK_BOOSTER)
84   SLOT_INTERFACE("wheel", VCS_WHEEL)
85   SLOT_INTERFACE("keypad", VCS_KEYPAD)
86SLOT_INTERFACE_END
Property changes on: trunk/src/emu/bus/vcs_ctrl/ctrl.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/joybooster.h
r0r31754
1/**********************************************************************
2
3    Atari Video Computer System digital joystick emulation with
4    boostergrip adapter
5
6    Copyright MESS Team.
7    Visit http://mamedev.org for licensing and usage restrictions.
8
9**********************************************************************/
10
11#pragma once
12
13#ifndef __VCS_JOYSTICKBOOSTER__
14#define __VCS_JOYSTICKBOOSTER__
15
16#include "emu.h"
17#include "ctrl.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> vcs_joystick_booster_device
26
27class vcs_joystick_booster_device : public device_t,
28                     public device_vcs_control_port_interface
29{
30public:
31   // construction/destruction
32   vcs_joystick_booster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34   // optional information overrides
35   virtual ioport_constructor device_input_ports() const;
36
37protected:
38   // device-level overrides
39   virtual void device_start();
40
41   // device_vcs_control_port_interface overrides
42   virtual UINT8 vcs_joy_r();
43   virtual UINT8 vcs_pot_x_r();
44   virtual UINT8 vcs_pot_y_r();
45
46   virtual bool has_pot_x() { return true; }
47   virtual bool has_pot_y() { return true; }
48
49private:
50   required_ioport m_joy;
51   required_ioport m_potx;
52   required_ioport m_poty;
53};
54
55
56// device type definition
57extern const device_type VCS_JOYSTICK_BOOSTER;
58
59
60#endif
Property changes on: trunk/src/emu/bus/vcs_ctrl/joybooster.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/joystick.h
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System digital joystick emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#pragma once
13
14#ifndef __VCS_JOYSTICK__
15#define __VCS_JOYSTICK__
16
17#include "emu.h"
18#include "ctrl.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> vcs_joystick_device
27
28class vcs_joystick_device : public device_t,
29                     public device_vcs_control_port_interface
30{
31public:
32   // construction/destruction
33   vcs_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual ioport_constructor device_input_ports() const;
37
38protected:
39   // device-level overrides
40   virtual void device_start();
41
42   // device_vcs_control_port_interface overrides
43   virtual UINT8 vcs_joy_r();
44
45private:
46   required_ioport m_joy;
47};
48
49
50// device type definition
51extern const device_type VCS_JOYSTICK;
52
53
54#endif
Property changes on: trunk/src/emu/bus/vcs_ctrl/joystick.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/wheel.c
r0r31754
1/**********************************************************************
2
3    Atari Video Computer System Driving Wheel emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "wheel.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type VCS_WHEEL = &device_creator<vcs_wheel_device>;
19
20
21static INPUT_PORTS_START( vcs_wheel )
22   PORT_START("JOY")
23   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )                     // Pin 6
24   PORT_BIT( 0xdc, IP_ACTIVE_LOW, IPT_UNUSED )
25
26   PORT_START("WHEEL")
27   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(40) PORT_KEYDELTA(5)
28INPUT_PORTS_END
29
30
31//-------------------------------------------------
32//  input_ports - device-specific input ports
33//-------------------------------------------------
34
35ioport_constructor vcs_wheel_device::device_input_ports() const
36{
37   return INPUT_PORTS_NAME( vcs_wheel );
38}
39
40
41
42//**************************************************************************
43//  LIVE DEVICE
44//**************************************************************************
45
46//-------------------------------------------------
47//  vcs_wheel_device - constructor
48//-------------------------------------------------
49
50vcs_wheel_device::vcs_wheel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
51   device_t(mconfig, VCS_WHEEL, "Driving Wheel", tag, owner, clock, "vcs_wheel", __FILE__),
52   device_vcs_control_port_interface(mconfig, *this),
53   m_joy(*this, "JOY"),
54   m_wheel(*this, "WHEEL")
55{
56}
57
58
59//-------------------------------------------------
60//  device_start - device-specific startup
61//-------------------------------------------------
62
63void vcs_wheel_device::device_start()
64{
65}
66
67
68//-------------------------------------------------
69//  vcs_joy_r - joystick read
70//-------------------------------------------------
71
72UINT8 vcs_wheel_device::vcs_joy_r()
73{
74   static const UINT8 driving_lookup[4] = { 0x00, 0x02, 0x03, 0x01 };
75
76   return m_joy->read() | driving_lookup[ ( m_wheel->read() & 0x18 ) >> 3 ];
77}
Property changes on: trunk/src/emu/bus/vcs_ctrl/wheel.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/ctrl.h
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System controller port emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************
11
12
13**********************************************************************/
14
15#pragma once
16
17#ifndef __VCS_CONTROL_PORT__
18#define __VCS_CONTROL_PORT__
19
20#include "emu.h"
21
22
23
24//**************************************************************************
25//  INTERFACE CONFIGURATION MACROS
26//**************************************************************************
27
28#define MCFG_VCS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \
29   MCFG_DEVICE_ADD(_tag, VCS_CONTROL_PORT, 0) \
30   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
31
32
33#define MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(_write) \
34   devcb = &vcs_control_port_device::set_trigger_wr_callback(*device, DEVCB_##_write);
35
36
37
38//**************************************************************************
39//  TYPE DEFINITIONS
40//**************************************************************************
41
42class vcs_control_port_device;
43
44
45// ======================> device_vcs_control_port_interface
46
47class device_vcs_control_port_interface : public device_slot_card_interface
48{
49public:
50   // construction/destruction
51   device_vcs_control_port_interface(const machine_config &mconfig, device_t &device);
52   virtual ~device_vcs_control_port_interface() { }
53
54   virtual UINT8 vcs_joy_r() { return 0xff; };
55   virtual UINT8 vcs_pot_x_r() { return 0xff; };
56   virtual UINT8 vcs_pot_y_r() { return 0xff; };
57   virtual void vcs_joy_w(UINT8 data) { };
58
59   virtual bool has_pot_x() { return false; }
60   virtual bool has_pot_y() { return false; }
61
62protected:
63   vcs_control_port_device *m_port;
64};
65
66
67// ======================> vcs_control_port_device
68
69class vcs_control_port_device : public device_t,
70                        public device_slot_interface
71{
72public:
73   // construction/destruction
74   vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
75   virtual ~vcs_control_port_device() { }
76
77   // static configuration helpers
78   template<class _Object> static devcb_base &set_trigger_wr_callback(device_t &device, _Object object) { return downcast<vcs_control_port_device &>(device).m_write_trigger.set_callback(object); }
79
80   // computer interface
81
82   // Data returned by the joy_r methods:
83   // bit 0 - pin 1 - Up
84   // bit 1 - pin 2 - Down
85   // bit 2 - pin 3 - Left
86   // bit 3 - pin 4 - Right
87   // bit 4 - pin 5 -
88   // bit 5 - pin 6 - Button
89   //         pin 7 - +5V
90   //         pin 8 - GND
91   // bit 6 - pin 9 -
92   //
93   UINT8 joy_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_joy_r(); return data; }
94   DECLARE_READ8_MEMBER( joy_r ) { return joy_r(); }
95   UINT8 pot_x_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_x_r(); return data; }
96   DECLARE_READ8_MEMBER( pot_x_r ) { return pot_x_r(); }
97   UINT8 pot_y_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_y_r(); return data; }
98   DECLARE_READ8_MEMBER( pot_y_r ) { return pot_y_r(); }
99
100   void joy_w( UINT8 data ) { if ( exists() ) m_device->vcs_joy_w( data ); }
101   DECLARE_WRITE8_MEMBER( joy_w );
102
103   bool exists() { return m_device != NULL; }
104   bool has_pot_x() { return exists() && m_device->has_pot_x(); }
105   bool has_pot_y() { return exists() && m_device->has_pot_y(); }
106
107   void trigger_w(int state) { m_write_trigger(state); }
108
109protected:
110   // device-level overrides
111   virtual void device_start();
112
113   device_vcs_control_port_interface *m_device;
114
115private:
116   devcb_write_line m_write_trigger;
117};
118
119
120// device type definition
121extern const device_type VCS_CONTROL_PORT;
122
123SLOT_INTERFACE_EXTERN( vcs_control_port_devices );
124
125
126
127#endif
Property changes on: trunk/src/emu/bus/vcs_ctrl/ctrl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/wheel.h
r0r31754
1/**********************************************************************
2
3    Atari Video Computer System Driving Wheel emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __VCS_WHEEL__
13#define __VCS_WHEEL__
14
15#include "emu.h"
16#include "ctrl.h"
17
18
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> vcs_wheel_device
25
26class vcs_wheel_device : public device_t,
27                     public device_vcs_control_port_interface
28{
29public:
30   // construction/destruction
31   vcs_wheel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   // optional information overrides
34   virtual ioport_constructor device_input_ports() const;
35
36protected:
37   // device-level overrides
38   virtual void device_start();
39
40   // device_vcs_control_port_interface overrides
41   virtual UINT8 vcs_joy_r();
42
43private:
44   required_ioport m_joy;
45   required_ioport m_wheel;
46};
47
48
49// device type definition
50extern const device_type VCS_WHEEL;
51
52
53#endif
Property changes on: trunk/src/emu/bus/vcs_ctrl/wheel.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vcs_ctrl/lightpen.c
r0r31754
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Atari Video Computer System lightpen emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#include "lightpen.h"
13
14
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type VCS_LIGHTPEN = &device_creator<vcs_lightpen_device>;
21
22
23INPUT_CHANGED_MEMBER( vcs_lightpen_device::trigger )
24{
25   // TODO trigger timer at correct screen position
26   m_port->trigger_w(newval);
27}
28
29
30static INPUT_PORTS_START( vcs_lightpen )
31   PORT_START("JOY")
32   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, vcs_lightpen_device, trigger, 0)
33   PORT_BIT( 0xdf, IP_ACTIVE_LOW, IPT_UNUSED )
34
35   PORT_START("LIGHTX")
36   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
37
38   PORT_START("LIGHTY")
39   PORT_BIT( 0xff, 0x00, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
40INPUT_PORTS_END
41
42
43//-------------------------------------------------
44//  input_ports - device-specific input ports
45//-------------------------------------------------
46
47ioport_constructor vcs_lightpen_device::device_input_ports() const
48{
49   return INPUT_PORTS_NAME( vcs_lightpen );
50}
51
52
53
54//**************************************************************************
55//  LIVE DEVICE
56//**************************************************************************
57
58//-------------------------------------------------
59//  vcs_lightpen_device - constructor
60//-------------------------------------------------
61
62vcs_lightpen_device::vcs_lightpen_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
63   device_t(mconfig, VCS_LIGHTPEN, "Light Pen", tag, owner, clock, "vcs_lightpen", __FILE__),
64   device_vcs_control_port_interface(mconfig, *this),
65   m_joy(*this, "JOY"),
66   m_lightx(*this, "LIGHTX"),
67   m_lighty(*this, "LIGHTY")
68{
69}
70
71
72//-------------------------------------------------
73//  device_start - device-specific startup
74//-------------------------------------------------
75
76void vcs_lightpen_device::device_start()
77{
78}
79
80
81//-------------------------------------------------
82//  vcs_joy_r - lightpen read
83//-------------------------------------------------
84
85UINT8 vcs_lightpen_device::vcs_joy_r()
86{
87   return m_joy->read();
88}
Property changes on: trunk/src/emu/bus/vcs_ctrl/lightpen.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/plus4/sid.h
r31753r31754
1616
1717#include "emu.h"
1818#include "exp.h"
19#include "bus/vcs/ctrl.h"
19#include "bus/vcs_ctrl/ctrl.h"
2020#include "sound/dac.h"
2121#include "sound/mos6581.h"
2222
trunk/src/mess/includes/c128.h
r31753r31754
1010#include "bus/c64/exp.h"
1111#include "bus/vic20/user.h"
1212#include "bus/pet/cass.h"
13#include "bus/vcs/ctrl.h"
13#include "bus/vcs_ctrl/ctrl.h"
1414#include "imagedev/snapquik.h"
1515#include "cpu/m6502/m8502.h"
1616#include "machine/mos6526.h"
trunk/src/mess/includes/vic20.h
r31753r31754
88#include "emu.h"
99#include "bus/cbmiec/cbmiec.h"
1010#include "bus/pet/cass.h"
11#include "bus/vcs/ctrl.h"
11#include "bus/vcs_ctrl/ctrl.h"
1212#include "bus/vic20/exp.h"
1313#include "bus/vic20/user.h"
1414#include "cpu/m6502/m6510.h"
trunk/src/mess/includes/c64.h
r31753r31754
1010#include "bus/c64/exp.h"
1111#include "bus/vic20/user.h"
1212#include "bus/pet/cass.h"
13#include "bus/vcs/ctrl.h"
13#include "bus/vcs_ctrl/ctrl.h"
1414#include "cpu/m6502/m6510.h"
1515#include "imagedev/snapquik.h"
1616#include "machine/mos6526.h"
trunk/src/mess/includes/plus4.h
r31753r31754
1010#include "bus/pet/cass.h"
1111#include "bus/plus4/exp.h"
1212#include "bus/plus4/user.h"
13#include "bus/vcs/ctrl.h"
13#include "bus/vcs_ctrl/ctrl.h"
1414#include "cpu/m6502/m7501.h"
1515#include "imagedev/snapquik.h"
1616#include "machine/mos6529.h"
trunk/src/mess/includes/cbm2.h
r31753r31754
1010#include "bus/cbm2/user.h"
1111#include "bus/ieee488/ieee488.h"
1212#include "bus/pet/cass.h"
13#include "bus/vcs/ctrl.h"
13#include "bus/vcs_ctrl/ctrl.h"
1414#include "cpu/m6502/m6509.h"
1515#include "cpu/i86/i86.h"
1616#include "machine/cbm_snqk.h"
trunk/src/mess/includes/vic10.h
r31753r31754
88#include "emu.h"
99#include "bus/pet/cass.h"
1010#include "bus/vic10/exp.h"
11#include "bus/vcs/ctrl.h"
11#include "bus/vcs_ctrl/ctrl.h"
1212#include "cpu/m6502/m6510.h"
1313#include "machine/mos6526.h"
1414#include "machine/ram.h"
trunk/src/mess/mess.mak
r31753r31754
614614BUSES += TI99PEB
615615BUSES += TVC
616616BUSES += VCS
617BUSES += VCS_CTRL
617618BUSES += VIC10
618619BUSES += VIC20
619620BUSES += VIDBRAIN

Previous 199869 Revisions Next


© 1997-2024 The MAME Team