summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/mess/drivers/c128.c30
-rw-r--r--src/mess/drivers/c64.c37
-rw-r--r--src/mess/machine/c64_multiscreen.c6
-rw-r--r--src/mess/machine/vcs_joy.c5
-rw-r--r--src/mess/machine/vcs_joy.h3
-rw-r--r--src/mess/machine/vcs_joybooster.c11
-rw-r--r--src/mess/machine/vcs_joybooster.h8
-rw-r--r--src/mess/machine/vcs_keypad.c9
-rw-r--r--src/mess/machine/vcs_keypad.h8
-rw-r--r--src/mess/machine/vcs_lightpen.c7
-rw-r--r--src/mess/machine/vcs_lightpen.h5
-rw-r--r--src/mess/machine/vcs_paddles.c11
-rw-r--r--src/mess/machine/vcs_paddles.h8
-rw-r--r--src/mess/machine/vcs_wheel.c6
-rw-r--r--src/mess/machine/vcs_wheel.h4
-rw-r--r--src/mess/machine/vcsctrl.c16
-rw-r--r--src/mess/machine/vcsctrl.h7
17 files changed, 144 insertions, 37 deletions
diff --git a/src/mess/drivers/c128.c b/src/mess/drivers/c128.c
index e1c9b6f9e7e..9c2bf5181eb 100644
--- a/src/mess/drivers/c128.c
+++ b/src/mess/drivers/c128.c
@@ -927,7 +927,20 @@ READ8_MEMBER( c128_state::sid_potx_r )
{
case 1: data = m_joy1->pot_x_r(); break;
case 2: data = m_joy2->pot_x_r(); break;
- case 3: break; // TODO pot1 and pot2 in series
+ case 3:
+ if (m_joy1->has_pot_x() && m_joy2->has_pot_x())
+ {
+ data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r());
+ }
+ else if (m_joy1->has_pot_x())
+ {
+ data = m_joy1->pot_x_r();
+ }
+ else if (m_joy2->has_pot_x())
+ {
+ data = m_joy2->pot_x_r();
+ }
+ break;
}
return data;
@@ -941,7 +954,20 @@ READ8_MEMBER( c128_state::sid_poty_r )
{
case 1: data = m_joy1->pot_y_r(); break;
case 2: data = m_joy2->pot_y_r(); break;
- case 3: break; // TODO pot1 and pot2 in series
+ case 3:
+ if (m_joy1->has_pot_y() && m_joy2->has_pot_y())
+ {
+ data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r());
+ }
+ else if (m_joy1->has_pot_y())
+ {
+ data = m_joy1->pot_y_r();
+ }
+ else if (m_joy2->has_pot_y())
+ {
+ data = m_joy2->pot_y_r();
+ }
+ break;
}
return data;
diff --git a/src/mess/drivers/c64.c b/src/mess/drivers/c64.c
index c451e7828ca..f056732c959 100644
--- a/src/mess/drivers/c64.c
+++ b/src/mess/drivers/c64.c
@@ -8,14 +8,7 @@
- IRQ (WRONG $DC0D)
- NMI (WRONG $DD0D)
- some CIA tests
-
- 64C PLA dump
- - Multiscreen crashes on boot
-
- 805A: lda $01
- 805C: and #$FE
- 805E: sta $01
- 8060: m6502_brk#$00 <-- BOOM!
*/
@@ -512,7 +505,20 @@ READ8_MEMBER( c64_state::sid_potx_r )
{
case 1: data = m_joy1->pot_x_r(); break;
case 2: data = m_joy2->pot_x_r(); break;
- case 3: break; // TODO pot1 and pot2 in series
+ case 3:
+ if (m_joy1->has_pot_x() && m_joy2->has_pot_x())
+ {
+ data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r());
+ }
+ else if (m_joy1->has_pot_x())
+ {
+ data = m_joy1->pot_x_r();
+ }
+ else if (m_joy2->has_pot_x())
+ {
+ data = m_joy2->pot_x_r();
+ }
+ break;
}
return data;
@@ -526,7 +532,20 @@ READ8_MEMBER( c64_state::sid_poty_r )
{
case 1: data = m_joy1->pot_y_r(); break;
case 2: data = m_joy2->pot_y_r(); break;
- case 3: break; // TODO pot1 and pot2 in series
+ case 3:
+ if (m_joy1->has_pot_y() && m_joy2->has_pot_y())
+ {
+ data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r());
+ }
+ else if (m_joy1->has_pot_y())
+ {
+ data = m_joy1->pot_y_r();
+ }
+ else if (m_joy2->has_pot_y())
+ {
+ data = m_joy2->pot_y_r();
+ }
+ break;
}
return data;
diff --git a/src/mess/machine/c64_multiscreen.c b/src/mess/machine/c64_multiscreen.c
index eb4f377392d..fae297e56aa 100644
--- a/src/mess/machine/c64_multiscreen.c
+++ b/src/mess/machine/c64_multiscreen.c
@@ -48,6 +48,12 @@
TODO:
- M6802 board
+ - crashes on boot
+
+ 805A: lda $01
+ 805C: and #$FE
+ 805E: sta $01
+ 8060: m6502_brk#$00 <-- BOOM!
*/
diff --git a/src/mess/machine/vcs_joy.c b/src/mess/machine/vcs_joy.c
index 775df9ceffd..4788b479dd4 100644
--- a/src/mess/machine/vcs_joy.c
+++ b/src/mess/machine/vcs_joy.c
@@ -50,7 +50,8 @@ ioport_constructor vcs_joystick_device::device_input_ports() const
vcs_joystick_device::vcs_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, VCS_JOYSTICK, "Digital joystick", tag, owner, clock),
- device_vcs_control_port_interface(mconfig, *this)
+ device_vcs_control_port_interface(mconfig, *this),
+ m_joy(*this, "JOY")
{
}
@@ -70,5 +71,5 @@ void vcs_joystick_device::device_start()
UINT8 vcs_joystick_device::vcs_joy_r()
{
- return ioport("JOY")->read();
+ return m_joy->read();
}
diff --git a/src/mess/machine/vcs_joy.h b/src/mess/machine/vcs_joy.h
index 5873903d056..791ce7663a0 100644
--- a/src/mess/machine/vcs_joy.h
+++ b/src/mess/machine/vcs_joy.h
@@ -41,6 +41,9 @@ protected:
// device_vcs_control_port_interface overrides
virtual UINT8 vcs_joy_r();
+
+private:
+ required_ioport m_joy;
};
diff --git a/src/mess/machine/vcs_joybooster.c b/src/mess/machine/vcs_joybooster.c
index 8dbcfff78bb..bb3809b6aea 100644
--- a/src/mess/machine/vcs_joybooster.c
+++ b/src/mess/machine/vcs_joybooster.c
@@ -59,7 +59,10 @@ ioport_constructor vcs_joystick_booster_device::device_input_ports() const
vcs_joystick_booster_device::vcs_joystick_booster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, VCS_JOYSTICK_BOOSTER, "Digital joystick with Boostergrip", tag, owner, clock),
- device_vcs_control_port_interface(mconfig, *this)
+ device_vcs_control_port_interface(mconfig, *this),
+ m_joy(*this, "JOY"),
+ m_potx(*this, "POTX"),
+ m_poty(*this, "POTY")
{
}
@@ -79,15 +82,15 @@ void vcs_joystick_booster_device::device_start()
UINT8 vcs_joystick_booster_device::vcs_joy_r()
{
- return ioport("JOY")->read();
+ return m_joy->read();
}
UINT8 vcs_joystick_booster_device::vcs_pot_x_r()
{
- return ioport("POTX")->read();
+ return m_potx->read();
}
UINT8 vcs_joystick_booster_device::vcs_pot_y_r()
{
- return ioport("POTY")->read();
+ return m_poty->read();
}
diff --git a/src/mess/machine/vcs_joybooster.h b/src/mess/machine/vcs_joybooster.h
index 89f110b0878..ae914b36617 100644
--- a/src/mess/machine/vcs_joybooster.h
+++ b/src/mess/machine/vcs_joybooster.h
@@ -44,6 +44,14 @@ protected:
virtual UINT8 vcs_joy_r();
virtual UINT8 vcs_pot_x_r();
virtual UINT8 vcs_pot_y_r();
+
+ virtual bool has_pot_x() { return true; }
+ virtual bool has_pot_y() { return true; }
+
+private:
+ required_ioport m_joy;
+ required_ioport m_potx;
+ required_ioport m_poty;
};
diff --git a/src/mess/machine/vcs_keypad.c b/src/mess/machine/vcs_keypad.c
index 69038faf26b..55685ae0c8b 100644
--- a/src/mess/machine/vcs_keypad.c
+++ b/src/mess/machine/vcs_keypad.c
@@ -56,7 +56,8 @@ ioport_constructor vcs_keypad_device::device_input_ports() const
vcs_keypad_device::vcs_keypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, VCS_KEYPAD, "Keypad", tag, owner, clock),
- device_vcs_control_port_interface(mconfig, *this)
+ device_vcs_control_port_interface(mconfig, *this),
+ m_keypad(*this, "KEYPAD")
{
}
@@ -82,7 +83,7 @@ UINT8 vcs_keypad_device::vcs_joy_r()
{
if ( ! ( ( m_column >> i ) & 0x01 ) )
{
- if ( ( ioport("KEYPAD")->read() >> 3*i ) & 0x04 )
+ if ( ( m_keypad->read() >> 3*i ) & 0x04 )
{
return 0xff;
}
@@ -106,7 +107,7 @@ UINT8 vcs_keypad_device::vcs_pot_x_r()
{
if ( ! ( ( m_column >> i ) & 0x01 ) )
{
- if ( ( ioport("KEYPAD")->read() >> 3*i ) & 0x01 )
+ if ( ( m_keypad->read() >> 3*i ) & 0x01 )
{
return 0;
}
@@ -125,7 +126,7 @@ UINT8 vcs_keypad_device::vcs_pot_y_r()
{
if ( ! ( ( m_column >> i ) & 0x01 ) )
{
- if ( ( ioport("KEYPAD")->read() >> 3*i ) & 0x02 )
+ if ( ( m_keypad->read() >> 3*i ) & 0x02 )
{
return 0;
}
diff --git a/src/mess/machine/vcs_keypad.h b/src/mess/machine/vcs_keypad.h
index 5cdb194f018..8643386133b 100644
--- a/src/mess/machine/vcs_keypad.h
+++ b/src/mess/machine/vcs_keypad.h
@@ -25,7 +25,7 @@
// ======================> vcs_keypad_device
class vcs_keypad_device : public device_t,
- public device_vcs_control_port_interface
+ public device_vcs_control_port_interface
{
public:
// construction/destruction
@@ -45,6 +45,12 @@ protected:
virtual UINT8 vcs_pot_x_r();
virtual UINT8 vcs_pot_y_r();
+ virtual bool has_pot_x() { return true; }
+ virtual bool has_pot_y() { return true; }
+
+private:
+ required_ioport m_keypad;
+
UINT8 m_column;
};
diff --git a/src/mess/machine/vcs_lightpen.c b/src/mess/machine/vcs_lightpen.c
index e4c392e2fc7..c9ec39a4383 100644
--- a/src/mess/machine/vcs_lightpen.c
+++ b/src/mess/machine/vcs_lightpen.c
@@ -58,7 +58,10 @@ ioport_constructor vcs_lightpen_device::device_input_ports() const
vcs_lightpen_device::vcs_lightpen_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, VCS_LIGHTPEN, "Light Pen", tag, owner, clock),
- device_vcs_control_port_interface(mconfig, *this)
+ device_vcs_control_port_interface(mconfig, *this),
+ m_joy(*this, "JOY"),
+ m_lightx(*this, "LIGHTX"),
+ m_lighty(*this, "LIGHTY")
{
}
@@ -78,5 +81,5 @@ void vcs_lightpen_device::device_start()
UINT8 vcs_lightpen_device::vcs_joy_r()
{
- return ioport("JOY")->read();
+ return m_joy->read();
}
diff --git a/src/mess/machine/vcs_lightpen.h b/src/mess/machine/vcs_lightpen.h
index 958d7b08045..b29be54d56c 100644
--- a/src/mess/machine/vcs_lightpen.h
+++ b/src/mess/machine/vcs_lightpen.h
@@ -43,6 +43,11 @@ protected:
// device_vcs_control_port_interface overrides
virtual UINT8 vcs_joy_r();
+
+private:
+ required_ioport m_joy;
+ required_ioport m_lightx;
+ required_ioport m_lighty;
};
diff --git a/src/mess/machine/vcs_paddles.c b/src/mess/machine/vcs_paddles.c
index 129c9ab2c24..ed9b82e2b34 100644
--- a/src/mess/machine/vcs_paddles.c
+++ b/src/mess/machine/vcs_paddles.c
@@ -53,7 +53,10 @@ ioport_constructor vcs_paddles_device::device_input_ports() const
vcs_paddles_device::vcs_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, VCS_PADDLES, "Digital paddles", tag, owner, clock),
- device_vcs_control_port_interface(mconfig, *this)
+ device_vcs_control_port_interface(mconfig, *this),
+ m_joy(*this, "JOY"),
+ m_potx(*this, "POTX"),
+ m_poty(*this, "POTY")
{
}
@@ -73,7 +76,7 @@ void vcs_paddles_device::device_start()
UINT8 vcs_paddles_device::vcs_joy_r()
{
- return ioport("JOY")->read();
+ return m_joy->read();
}
@@ -83,7 +86,7 @@ UINT8 vcs_paddles_device::vcs_joy_r()
UINT8 vcs_paddles_device::vcs_pot_x_r()
{
- return ioport("POTX")->read();
+ return m_potx->read();
}
@@ -93,5 +96,5 @@ UINT8 vcs_paddles_device::vcs_pot_x_r()
UINT8 vcs_paddles_device::vcs_pot_y_r()
{
- return ioport("POTY")->read();
+ return m_poty->read();
}
diff --git a/src/mess/machine/vcs_paddles.h b/src/mess/machine/vcs_paddles.h
index c2056dc7884..535ae2f573f 100644
--- a/src/mess/machine/vcs_paddles.h
+++ b/src/mess/machine/vcs_paddles.h
@@ -43,6 +43,14 @@ protected:
virtual UINT8 vcs_joy_r();
virtual UINT8 vcs_pot_x_r();
virtual UINT8 vcs_pot_y_r();
+
+ virtual bool has_pot_x() { return true; }
+ virtual bool has_pot_y() { return true; }
+
+private:
+ required_ioport m_joy;
+ required_ioport m_potx;
+ required_ioport m_poty;
};
diff --git a/src/mess/machine/vcs_wheel.c b/src/mess/machine/vcs_wheel.c
index b26def6c02b..ab159b098d0 100644
--- a/src/mess/machine/vcs_wheel.c
+++ b/src/mess/machine/vcs_wheel.c
@@ -49,7 +49,9 @@ ioport_constructor vcs_wheel_device::device_input_ports() const
vcs_wheel_device::vcs_wheel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, VCS_WHEEL, "Driving Wheel", tag, owner, clock),
- device_vcs_control_port_interface(mconfig, *this)
+ device_vcs_control_port_interface(mconfig, *this),
+ m_joy(*this, "JOY"),
+ m_wheel(*this, "WHEEL")
{
}
@@ -71,5 +73,5 @@ UINT8 vcs_wheel_device::vcs_joy_r()
{
static const UINT8 driving_lookup[4] = { 0x00, 0x02, 0x03, 0x01 };
- return ioport("JOY")->read() | driving_lookup[ ( ioport("WHEEL")->read() & 0x18 ) >> 3 ];
+ return m_joy->read() | driving_lookup[ ( m_wheel->read() & 0x18 ) >> 3 ];
}
diff --git a/src/mess/machine/vcs_wheel.h b/src/mess/machine/vcs_wheel.h
index 09cd0e12565..9d8a5e8af5f 100644
--- a/src/mess/machine/vcs_wheel.h
+++ b/src/mess/machine/vcs_wheel.h
@@ -41,6 +41,10 @@ protected:
// device_vcs_control_port_interface overrides
virtual UINT8 vcs_joy_r();
+
+private:
+ required_ioport m_joy;
+ required_ioport m_wheel;
};
diff --git a/src/mess/machine/vcsctrl.c b/src/mess/machine/vcsctrl.c
index e550b6785d9..8b7158b0cde 100644
--- a/src/mess/machine/vcsctrl.c
+++ b/src/mess/machine/vcsctrl.c
@@ -53,8 +53,8 @@ device_vcs_control_port_interface::~device_vcs_control_port_interface()
//-------------------------------------------------
vcs_control_port_device::vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
- device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock),
- device_slot_interface(mconfig, *this)
+ device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock),
+ device_slot_interface(mconfig, *this)
{
}
@@ -78,15 +78,17 @@ void vcs_control_port_device::device_start()
}
-UINT8 vcs_control_port_device::joy_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_joy_r(); return data; }
+UINT8 vcs_control_port_device::joy_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_joy_r(); return data; }
READ8_MEMBER( vcs_control_port_device::joy_r ) { return joy_r(); }
-UINT8 vcs_control_port_device::pot_x_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_pot_x_r(); return data; }
+UINT8 vcs_control_port_device::pot_x_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_x_r(); return data; }
READ8_MEMBER( vcs_control_port_device::pot_x_r ) { return pot_x_r(); }
-UINT8 vcs_control_port_device::pot_y_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_pot_y_r(); return data; }
+UINT8 vcs_control_port_device::pot_y_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_y_r(); return data; }
READ8_MEMBER( vcs_control_port_device::pot_y_r ) { return pot_y_r(); }
-void vcs_control_port_device::joy_w( UINT8 data ) { if ( m_device != NULL ) m_device->vcs_joy_w( data ); }
+void vcs_control_port_device::joy_w( UINT8 data ) { if ( exists() ) m_device->vcs_joy_w( data ); }
WRITE8_MEMBER( vcs_control_port_device::joy_w ) { joy_w(data); }
-
+bool vcs_control_port_device::exists() { return m_device != NULL; }
+bool vcs_control_port_device::has_pot_x() { return exists() && m_device->has_pot_x(); }
+bool vcs_control_port_device::has_pot_y() { return exists() && m_device->has_pot_y(); }
//-------------------------------------------------
// SLOT_INTERFACE( vcs_control_port_devices )
diff --git a/src/mess/machine/vcsctrl.h b/src/mess/machine/vcsctrl.h
index a0fe814144c..004c3c54210 100644
--- a/src/mess/machine/vcsctrl.h
+++ b/src/mess/machine/vcsctrl.h
@@ -68,6 +68,10 @@ public:
void joy_w( UINT8 data );
DECLARE_WRITE8_MEMBER( joy_w );
+ bool exists();
+ bool has_pot_x();
+ bool has_pot_y();
+
protected:
// device-level overrides
virtual void device_start();
@@ -91,6 +95,9 @@ public:
virtual UINT8 vcs_pot_y_r() { return 0xff; };
virtual void vcs_joy_w(UINT8 data) { };
+ virtual bool has_pot_x() { return false; }
+ virtual bool has_pot_y() { return false; }
+
protected:
vcs_control_port_device *m_port;
};