[mess] finish modernizing pc joystick and remove tag lookups (nw)

This commit is contained in:
cracyc 2013-01-24 19:13:00 +00:00
parent 336dc3ca2d
commit 9dcc25d442
4 changed files with 64 additions and 76 deletions

View File

@ -88,7 +88,7 @@ static ADDRESS_MAP_START(ppc512_io, AS_IO, 16, pc_state )
AM_RANGE(0x0078, 0x0079) AM_READWRITE8_LEGACY(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff)
AM_RANGE(0x007a, 0x007b) AM_READWRITE8_LEGACY(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff)
AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
AM_RANGE(0x0278, 0x027b) AM_READ8_LEGACY(pc200_port278_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_2", pc_lpt_w, 0x00ff)
AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
@ -116,7 +116,7 @@ static ADDRESS_MAP_START(pc200_io, AS_IO, 16, pc_state )
AM_RANGE(0x0078, 0x0079) AM_READWRITE8_LEGACY(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff)
AM_RANGE(0x007a, 0x007b) AM_READWRITE8_LEGACY(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff)
AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
AM_RANGE(0x0278, 0x027b) AM_READ8_LEGACY(pc200_port278_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_2", pc_lpt_w, 0x00ff)
AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
@ -196,7 +196,6 @@ Since pc200 is anyway NOT_WORKING, I comment out this one */
PORT_BIT( 0x01, 0x01, IPT_UNUSED )
PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */
PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */
PORT_START("VIDEO") /* IN20 */
PORT_CONFNAME( 0x03, 0x03, "IDA character set")
@ -299,6 +298,8 @@ static MACHINE_CONFIG_START( pc200, pc_state )
MCFG_PC_FDC_XT_ADD("fdc")
MCFG_PC_JOY_ADD("joy")
MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)
@ -370,6 +371,8 @@ static MACHINE_CONFIG_START( ppc512, pc_state )
MCFG_PC_FDC_XT_ADD("fdc")
MCFG_PC_JOY_ADD("joy")
MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)

View File

@ -195,7 +195,7 @@ static ADDRESS_MAP_START(pc8_io, AS_IO, 8, pc_state )
AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r, pc_page_w)
AM_RANGE(0x00a0, 0x00a0) AM_WRITE(pc_nmi_enable_w )
AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r, pc_JOY_w)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc_rtc_r, pc_rtc_w)
AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w)
AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_device, ins8250_r, ins8250_w)
@ -221,7 +221,7 @@ static ADDRESS_MAP_START(pc16_io, AS_IO, 16, pc_state )
AM_RANGE(0x0070, 0x007f) AM_RAM // needed for Poisk-2
AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
AM_RANGE(0x00a0, 0x00a1) AM_WRITE8(pc_nmi_enable_w, 0x00ff )
AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
AM_RANGE(0x0240, 0x0257) AM_READWRITE8(pc_rtc_r, pc_rtc_w, 0xffff)
AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w, 0xffff)
AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
@ -296,7 +296,7 @@ static ADDRESS_MAP_START(ibm5550_io, AS_IO, 16, pc_state )
AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xffff)
AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
AM_RANGE(0x00a0, 0x00a1) AM_READWRITE8(unk_r, pc_nmi_enable_w, 0x00ff )
AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
AM_RANGE(0x0240, 0x0257) AM_READWRITE8(pc_rtc_r, pc_rtc_w, 0xffff)
AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w, 0xffff)
AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
@ -327,7 +327,7 @@ static ADDRESS_MAP_START(europc_io, AS_IO, 8, pc_state )
AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
AM_RANGE(0x0060, 0x0063) AM_READWRITE_LEGACY(europc_pio_r, europc_pio_w)
AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r, pc_page_w)
AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r, pc_JOY_w)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
AM_RANGE(0x0250, 0x025f) AM_READWRITE_LEGACY(europc_jim_r, europc_jim_w)
AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w)
AM_RANGE(0x02e0, 0x02e0) AM_READ_LEGACY(europc_jim2_r)
@ -362,7 +362,7 @@ static ADDRESS_MAP_START(tandy1000_io, AS_IO, 8, pc_state )
AM_RANGE(0x0060, 0x0063) AM_READWRITE_LEGACY(tandy1000_pio_r, tandy1000_pio_w)
AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r, pc_page_w)
AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", ncr7496_device, write)
AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r, pc_JOY_w)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
AM_RANGE(0x0378, 0x037f) AM_READWRITE_LEGACY(pc_t1t_p37x_r, pc_t1t_p37x_w)
AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w)
@ -392,7 +392,7 @@ static ADDRESS_MAP_START(tandy1000_16_io, AS_IO, 16, pc_state )
AM_RANGE(0x0060, 0x0063) AM_READWRITE8_LEGACY(tandy1000_pio_r, tandy1000_pio_w, 0xffff)
AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496", ncr7496_device, write, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
AM_RANGE(0x0378, 0x037f) AM_READWRITE8_LEGACY(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff)
AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff)
@ -423,7 +423,7 @@ static ADDRESS_MAP_START(tandy1000_286_io, AS_IO, 16, pc_state )
AM_RANGE(0x0060, 0x0063) AM_READWRITE8_LEGACY(tandy1000_pio_r, tandy1000_pio_w, 0xffff)
AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496", ncr7496_device, write, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
AM_RANGE(0x0378, 0x037f) AM_READWRITE8_LEGACY(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff)
AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff)
@ -455,7 +455,7 @@ static ADDRESS_MAP_START(ibmpcjr_io, AS_IO, 8, pc_state )
AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", sn76496_device, write)
AM_RANGE(0x00f2, 0x00f2) AM_WRITE(pcjr_fdc_dor_w)
AM_RANGE(0x00f4, 0x00f5) AM_DEVICE("upd765", upd765a_device, map)
AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r, pc_JOY_w)
AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
AM_RANGE(0x0378, 0x037f) AM_READWRITE_LEGACY(pc_t1t_p37x_r, pc_t1t_p37x_w)
AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w)
@ -538,7 +538,6 @@ static INPUT_PORTS_START( pccga )
PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */
PORT_BIT( 0x01, 0x01, IPT_UNUSED )
PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */
PORT_INCLUDE( pcvideo_cga )
INPUT_PORTS_END
@ -607,7 +606,6 @@ static INPUT_PORTS_START( pcega )
PORT_BIT( 0x02, 0x02, IPT_UNUSED ) /* no turbo switch */
PORT_BIT( 0x01, 0x01, IPT_UNUSED )
PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */
PORT_INCLUDE( pcvideo_cga )
INPUT_PORTS_END
@ -658,7 +656,6 @@ static INPUT_PORTS_START( europc )
EUROPC_KEYBOARD
PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */
PORT_INCLUDE( pcvideo_cga )
INPUT_PORTS_END
@ -730,7 +727,6 @@ static INPUT_PORTS_START( bondwell )
PORT_BIT( 0x01, 0x01, IPT_UNUSED )
// PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */
PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */
PORT_INCLUDE( pcvideo_cga )
INPUT_PORTS_END
@ -770,7 +766,6 @@ static INPUT_PORTS_START( tandy1t )
PORT_BIT( 0x01, 0x01, IPT_UNUSED )
PORT_INCLUDE( t1000_keyboard )
PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */
INPUT_PORTS_END
static INPUT_PORTS_START( ibmpcjr )
@ -999,6 +994,7 @@ static MACHINE_CONFIG_START( pccga, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
@ -1064,6 +1060,7 @@ static MACHINE_CONFIG_START( europc, pc_state )
MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
MCFG_PC_JOY_ADD("joy")
/* video hardware */
MCFG_FRAGMENT_ADD( pcvideo_aga )
@ -1130,6 +1127,7 @@ static MACHINE_CONFIG_START( t1000hx, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
@ -1183,6 +1181,7 @@ static MACHINE_CONFIG_START( t1000_16, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "35dd", 0, pc_state::floppy_formats)
@ -1231,6 +1230,7 @@ static MACHINE_CONFIG_START( t1000_286, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "35dd", 0, pc_state::floppy_formats)
@ -1299,6 +1299,7 @@ static MACHINE_CONFIG_START( ibmpcjr, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
/* cassette */
MCFG_CASSETTE_ADD( CASSETTE_TAG, ibm5150_cassette_interface )
@ -1539,6 +1540,7 @@ static MACHINE_CONFIG_START( iskr3104, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
@ -1594,6 +1596,7 @@ static MACHINE_CONFIG_START( poisk2, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
@ -1648,6 +1651,7 @@ static MACHINE_CONFIG_START( zenith, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
@ -1702,6 +1706,7 @@ static MACHINE_CONFIG_START( olivetti, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")
@ -1756,6 +1761,7 @@ static MACHINE_CONFIG_START( ibm5550, pc_state )
MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
MCFG_PC_JOY_ADD("joy")
MCFG_PC_FDC_XT_ADD("fdc")

View File

@ -9,89 +9,65 @@
#include "emu.h"
#include "pc_joy.h"
static attotime JOY_time;
READ8_HANDLER ( pc_JOY_r )
READ8_MEMBER ( pc_joy_device::joy_port_r )
{
UINT8 data = 0xf;
int delta;
attotime new_time = space.machine().time();
ioport_port *joystick_port = space.machine().root_device().ioport("pc_joy");
delta = ((new_time - JOY_time) * 256 * 1000).seconds;
attotime new_time = machine().time();
delta = ((new_time - m_stime) * 256 * 1000).seconds;
if (joystick_port != NULL)
{
data = joystick_port->read() ^ 0xf0;
data = m_btn->read() ^ 0xf0;
/* timer overflow? Nope, otherwise some HWs can't verify the port properly */
//if ((new_time - JOY_time) > attotime::from_msec(10))
//{
//}
//else
{
if (space.machine().root_device().ioport("pc_joy_1")->read() < delta) data &= ~0x01;
if (space.machine().root_device().ioport("pc_joy_2")->read() < delta) data &= ~0x02;
if (space.machine().root_device().ioport("pc_joy_3")->read() < delta) data &= ~0x04;
if (space.machine().root_device().ioport("pc_joy_4")->read() < delta) data &= ~0x08;
}
}
else
{
data = 0xf0;
// TODO: find decay rate with no joystick connected
}
/* timer overflow? Nope, otherwise some HWs can't verify the port properly */
//if ((new_time - JOY_time) > attotime::from_msec(10))
//{
//}
//else
if (m_x1->read() < delta) data &= ~0x01;
if (m_y1->read() < delta) data &= ~0x02;
if (m_x2->read() < delta) data &= ~0x04;
if (m_y2->read() < delta) data &= ~0x08;
return data;
}
WRITE8_HANDLER ( pc_JOY_w )
WRITE8_MEMBER ( pc_joy_device::joy_port_w )
{
JOY_time = space.machine().time();
m_stime = machine().time();
}
INPUT_PORTS_START( pc_joystick_none )
PORT_START("pc_joy")
PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
PORT_START("pc_joy_1")
PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
PORT_START("pc_joy_2")
PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
PORT_START("pc_joy_3")
PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
PORT_START("pc_joy_4")
PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
INPUT_PORTS_END
INPUT_PORTS_START( pc_joystick )
PORT_START("pc_joy")
static INPUT_PORTS_START( pc_joystick )
PORT_START("btn")
PORT_BIT ( 0xf, 0xf, IPT_UNUSED )
PORT_BIT( 0x0010, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1")
PORT_BIT( 0x0020, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 1 Button 2")
PORT_BIT( 0x0040, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2)
PORT_BIT( 0x0080, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 2 Button 2") PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_START("pc_joy_1")
PORT_START("x1")
PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH)
PORT_START("pc_joy_2")
PORT_START("y1")
PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH)
PORT_START("pc_joy_3")
PORT_START("x2")
PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2)
PORT_START("pc_joy_4")
PORT_START("y2")
PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2)
INPUT_PORTS_END
const device_type PC_JOY = &device_creator<pc_joy_device>;
pc_joy_device::pc_joy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PC_JOY, "PC joystick", tag, owner, clock)
: device_t(mconfig, PC_JOY, "PC joystick", tag, owner, clock),
m_btn(*this, "btn"),
m_x1(*this, "x1"),
m_y1(*this, "y1"),
m_x2(*this, "x2"),
m_y2(*this, "y2")
{
}

View File

@ -11,12 +11,6 @@
#include "emu.h"
DECLARE_READ8_HANDLER ( pc_JOY_r );
DECLARE_WRITE8_HANDLER ( pc_JOY_w );
INPUT_PORTS_EXTERN( pc_joystick_none );
INPUT_PORTS_EXTERN( pc_joystick );
#define MCFG_PC_JOY_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, PC_JOY, 0)
@ -26,10 +20,19 @@ public:
pc_joy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ioport_constructor device_input_ports() const;
DECLARE_READ8_MEMBER(joy_port_r) { return pc_JOY_r(space, offset); }
DECLARE_WRITE8_MEMBER(joy_port_w) { pc_JOY_w(space, offset, data); }
DECLARE_READ8_MEMBER(joy_port_r);
DECLARE_WRITE8_MEMBER(joy_port_w);
protected:
virtual void device_start() {}
private:
required_ioport m_btn;
required_ioport m_x1;
required_ioport m_y1;
required_ioport m_x2;
required_ioport m_y2;
attotime m_stime;
};
extern const device_type PC_JOY;