mirror of
https://github.com/holub/mame
synced 2025-06-05 20:33:45 +03:00
Written a new device for Taito Yoke based inputs, i.e. ones found in Midnight Landing and Top Landing [Angelo Salese]
This commit is contained in:
parent
64c92a4f5f
commit
1fe82affcb
@ -3842,6 +3842,8 @@ files {
|
||||
MAME_DIR .. "src/mame/audio/taito_zm.h",
|
||||
MAME_DIR .. "src/mame/machine/taitoio.cpp",
|
||||
MAME_DIR .. "src/mame/machine/taitoio.h",
|
||||
MAME_DIR .. "src/mame/machine/taitoio_yoke.cpp",
|
||||
MAME_DIR .. "src/mame/machine/taitoio_yoke.h",
|
||||
MAME_DIR .. "src/mame/video/taito_helper.cpp",
|
||||
MAME_DIR .. "src/mame/video/taito_helper.h",
|
||||
MAME_DIR .. "src/mame/video/pc080sn.cpp",
|
||||
|
@ -300,28 +300,24 @@ WRITE16_MEMBER(taitoair_state::airsys_gradram_w)
|
||||
INPUTS
|
||||
***********************************************************/
|
||||
|
||||
#define STICK1_PORT_TAG "STICK1"
|
||||
#define STICK2_PORT_TAG "STICK2"
|
||||
#define STICK3_PORT_TAG "STICK3"
|
||||
|
||||
READ16_MEMBER(taitoair_state::stick_input_r)
|
||||
{
|
||||
switch( offset )
|
||||
{
|
||||
case 0x00: /* "counter 1" lo */
|
||||
return ioport(STICK1_PORT_TAG)->read();
|
||||
return m_yoke->throttle_r(space,0) & 0xff; //ioport(STICK1_PORT_TAG)->read();
|
||||
|
||||
case 0x01: /* "counter 2" lo */
|
||||
return ioport(STICK2_PORT_TAG)->read();
|
||||
return m_yoke->stickx_r(space,0) & 0xff;
|
||||
|
||||
case 0x02: /* "counter 1" hi */
|
||||
if(ioport(STICK1_PORT_TAG)->read() & 0x80)
|
||||
if(m_yoke->throttle_r(space,0) & 0x80)
|
||||
return 0xff;
|
||||
|
||||
return 0;
|
||||
|
||||
case 0x03: /* "counter 2" hi */
|
||||
return (ioport(STICK2_PORT_TAG)->read() & 0xff00) >> 8;
|
||||
return (m_yoke->stickx_r(space,0) & 0xff00) >> 8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -332,10 +328,10 @@ READ16_MEMBER(taitoair_state::stick2_input_r)
|
||||
switch( offset )
|
||||
{
|
||||
case 0x00: /* "counter 3" lo */
|
||||
return ioport(STICK3_PORT_TAG)->read();
|
||||
return m_yoke->sticky_r(space,0);
|
||||
|
||||
case 0x02: /* "counter 3" hi */
|
||||
return (ioport(STICK3_PORT_TAG)->read() & 0xff00) >> 8;
|
||||
return (m_yoke->sticky_r(space,0) & 0xff00) >> 8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -578,29 +574,20 @@ static INPUT_PORTS_START( topland )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* "door" (!) */
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Door Switch") /* "door" (!) */
|
||||
|
||||
PORT_START("IN1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* slot down */
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) /* slot up */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) /* handle */
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("yokectrl", taitoio_yoke_device, slot_down_r )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("yokectrl", taitoio_yoke_device, slot_up_r )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("yokectrl", taitoio_yoke_device, handle_left_r )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("yokectrl", taitoio_yoke_device, handle_right_r )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("yokectrl", taitoio_yoke_device, handle_down_r )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("yokectrl", taitoio_yoke_device, handle_up_r )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) // DMA status flag
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("IN2")
|
||||
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START(STICK1_PORT_TAG)
|
||||
PORT_BIT( 0x00ff, 0x0000, IPT_AD_STICK_Z ) PORT_MINMAX(0x0080,0x007f) PORT_SENSITIVITY(30) PORT_KEYDELTA(40) PORT_PLAYER(1) PORT_REVERSE
|
||||
|
||||
PORT_START(STICK2_PORT_TAG)
|
||||
PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_X ) PORT_MINMAX(0x00800, 0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
|
||||
|
||||
PORT_START(STICK3_PORT_TAG)
|
||||
PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_Y ) PORT_MINMAX(0x00800, 0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( ainferno )
|
||||
@ -641,6 +628,7 @@ static INPUT_PORTS_START( ainferno )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
|
||||
|
||||
PORT_START("IN1")
|
||||
// TODO: understand these
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* lever */
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) /* handle x */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* handle y */
|
||||
@ -652,15 +640,6 @@ static INPUT_PORTS_START( ainferno )
|
||||
|
||||
PORT_START("IN2")
|
||||
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START(STICK1_PORT_TAG)
|
||||
PORT_BIT( 0x00ff, 0x0000, IPT_AD_STICK_Z ) PORT_MINMAX(0x0080,0x007f) PORT_SENSITIVITY(30) PORT_KEYDELTA(40) PORT_PLAYER(1) PORT_REVERSE
|
||||
|
||||
PORT_START(STICK2_PORT_TAG)
|
||||
PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_X ) PORT_MINMAX(0x00800, 0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
|
||||
|
||||
PORT_START(STICK3_PORT_TAG)
|
||||
PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_Y ) PORT_MINMAX(0x00800, 0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
@ -745,6 +724,8 @@ static MACHINE_CONFIG_START( airsys )
|
||||
MCFG_TC0220IOC_WRITE_4_CB(WRITE8(taitoair_state, coin_control_w))
|
||||
MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2"))
|
||||
|
||||
MCFG_TAITOIO_YOKE_ADD("yokectrl")
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
|
@ -7,6 +7,7 @@
|
||||
*************************************************************************/
|
||||
|
||||
#include "machine/taitoio.h"
|
||||
#include "machine/taitoio_yoke.h"
|
||||
#include "video/tc0080vco.h"
|
||||
#include "screen.h"
|
||||
|
||||
@ -39,6 +40,7 @@ public:
|
||||
m_dsp(*this, "dsp"),
|
||||
m_tc0080vco(*this, "tc0080vco"),
|
||||
m_tc0220ioc(*this, "tc0220ioc"),
|
||||
m_yoke(*this, "yokectrl"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette")
|
||||
@ -64,6 +66,7 @@ public:
|
||||
required_device<cpu_device> m_dsp;
|
||||
required_device<tc0080vco_device> m_tc0080vco;
|
||||
required_device<tc0220ioc_device> m_tc0220ioc;
|
||||
required_device<taitoio_yoke_device> m_yoke;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
137
src/mame/machine/taitoio_yoke.cpp
Normal file
137
src/mame/machine/taitoio_yoke.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Angelo Salese
|
||||
/***************************************************************************
|
||||
|
||||
Taito Yoke + Throttle Flight device
|
||||
|
||||
Used in Midnight Landing, Top Landing and Air Inferno
|
||||
|
||||
TODO:
|
||||
- Custom part #;
|
||||
- Air Inferno uses different limit types (helicopter inputs?)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "taitoio_yoke.h"
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
// device type definition
|
||||
DEFINE_DEVICE_TYPE(TAITOIO_YOKE, taitoio_yoke_device, "namcoio_gearbox", "Namco I/O Gearbox")
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// taitoio_yoke_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
taitoio_yoke_device::taitoio_yoke_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, TAITOIO_YOKE, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void taitoio_yoke_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void taitoio_yoke_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( yoke_inputs )
|
||||
PORT_START("THROTTLE")
|
||||
PORT_BIT( 0x00ff, 0x0000, IPT_AD_STICK_Z ) PORT_MINMAX(0x0080,0x007f) PORT_SENSITIVITY(30) PORT_KEYDELTA(40) PORT_REVERSE
|
||||
|
||||
PORT_START("STICK_X")
|
||||
PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_X ) PORT_MINMAX(0x00800, 0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20)
|
||||
|
||||
PORT_START("STICK_Y")
|
||||
PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_Y ) PORT_MINMAX(0x00800, 0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20)
|
||||
INPUT_PORTS_END
|
||||
|
||||
ioport_constructor taitoio_yoke_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME( yoke_inputs );
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// READ/WRITE HANDLERS
|
||||
//**************************************************************************
|
||||
|
||||
READ16_MEMBER( taitoio_yoke_device::stickx_r )
|
||||
{
|
||||
return ioport("STICK_X")->read();
|
||||
}
|
||||
|
||||
READ16_MEMBER( taitoio_yoke_device::sticky_r )
|
||||
{
|
||||
return ioport("STICK_Y")->read();
|
||||
}
|
||||
|
||||
READ16_MEMBER( taitoio_yoke_device::throttle_r )
|
||||
{
|
||||
return ioport("THROTTLE")->read();
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( taitoio_yoke_device::slot_down_r )
|
||||
{
|
||||
uint16_t throttle = ioport("THROTTLE")->read();
|
||||
|
||||
return (throttle != 0) && (throttle & 0x80) == 0x00;
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( taitoio_yoke_device::slot_up_r )
|
||||
{
|
||||
uint16_t throttle = ioport("THROTTLE")->read();
|
||||
|
||||
return (throttle & 0x80) == 0x80;
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( taitoio_yoke_device::handle_left_r )
|
||||
{
|
||||
uint16_t x = ioport("STICK_X")->read();
|
||||
|
||||
return (x & 0x800) == 0x800;
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( taitoio_yoke_device::handle_right_r )
|
||||
{
|
||||
uint16_t x = ioport("STICK_X")->read();
|
||||
|
||||
return (x != 0) && (!(x & 0x800));
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( taitoio_yoke_device::handle_up_r )
|
||||
{
|
||||
uint16_t y = ioport("STICK_Y")->read();
|
||||
|
||||
return (y & 0x800) == 0x800;
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( taitoio_yoke_device::handle_down_r )
|
||||
{
|
||||
uint16_t y = ioport("STICK_Y")->read();
|
||||
|
||||
return (y != 0) && (!(y & 0x800));
|
||||
}
|
69
src/mame/machine/taitoio_yoke.h
Normal file
69
src/mame/machine/taitoio_yoke.h
Normal file
@ -0,0 +1,69 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Angelo Salese
|
||||
/***************************************************************************
|
||||
|
||||
Taito Yoke + Throttle Flight device
|
||||
|
||||
***************************************************************************/
|
||||
#ifndef MAME_MACHINE_TAITO_YOKE_H
|
||||
#define MAME_MACHINE_TAITO_YOKE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_TAITOIO_YOKE_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, TAITOIO_YOKE, 0)
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> namcoio_gearbox_device
|
||||
|
||||
class taitoio_yoke_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
taitoio_yoke_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// I/O operations
|
||||
DECLARE_READ16_MEMBER( throttle_r );
|
||||
DECLARE_READ16_MEMBER( stickx_r );
|
||||
DECLARE_READ16_MEMBER( sticky_r );
|
||||
|
||||
DECLARE_READ_LINE_MEMBER( slot_up_r );
|
||||
DECLARE_READ_LINE_MEMBER( slot_down_r );
|
||||
DECLARE_READ_LINE_MEMBER( handle_left_r );
|
||||
DECLARE_READ_LINE_MEMBER( handle_right_r );
|
||||
DECLARE_READ_LINE_MEMBER( handle_up_r );
|
||||
DECLARE_READ_LINE_MEMBER( handle_down_r );
|
||||
|
||||
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// virtual void device_validity_check(validity_checker &valid) const;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(TAITOIO_YOKE, taitoio_yoke_device)
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
|
||||
|
||||
#endif // MAME_MACHINE_TAITO_YOKE_H
|
Loading…
Reference in New Issue
Block a user