summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--src/mess/drivers/pc.c5
-rw-r--r--src/mess/machine/pc_joy.c2
-rw-r--r--src/mess/machine/pc_joy_sw.c177
-rw-r--r--src/mess/machine/pc_joy_sw.h36
-rw-r--r--src/mess/mess.mak1
6 files changed, 221 insertions, 2 deletions
diff --git a/.gitattributes b/.gitattributes
index 284bf254898..2af955bb646 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -7576,6 +7576,8 @@ src/mess/machine/pc_fdc.c svneol=native#text/plain
src/mess/machine/pc_fdc.h svneol=native#text/plain
src/mess/machine/pc_joy.c svneol=native#text/plain
src/mess/machine/pc_joy.h svneol=native#text/plain
+src/mess/machine/pc_joy_sw.c svneol=native#text/plain
+src/mess/machine/pc_joy_sw.h svneol=native#text/plain
src/mess/machine/pc_kbdc.c svneol=native#text/plain
src/mess/machine/pc_kbdc.h svneol=native#text/plain
src/mess/machine/pc_keyboards.c svneol=native#text/plain
diff --git a/src/mess/drivers/pc.c b/src/mess/drivers/pc.c
index d2e81e690fe..1d937385f93 100644
--- a/src/mess/drivers/pc.c
+++ b/src/mess/drivers/pc.c
@@ -1538,8 +1538,9 @@ static MACHINE_CONFIG_DERIVED( asst128, iskr1031 )
MCFG_CPU_PROGRAM_MAP(iskr1031_map)
MCFG_CPU_IO_MAP(asst128_io)
- MCFG_DEVICE_REMOVE("fdc:0");
- MCFG_DEVICE_REMOVE("fdc:1");
+ MCFG_DEVICE_REMOVE("dma8237")
+ MCFG_DEVICE_REMOVE("fdc:0")
+ MCFG_DEVICE_REMOVE("fdc:1")
MCFG_FLOPPY_DRIVE_ADD("fdc:0", asst128_floppies, "525ssqd", 0, pc_state::asst128_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", asst128_floppies, "525ssqd", 0, pc_state::asst128_formats)
diff --git a/src/mess/machine/pc_joy.c b/src/mess/machine/pc_joy.c
index b65593d3f39..665bd68d42b 100644
--- a/src/mess/machine/pc_joy.c
+++ b/src/mess/machine/pc_joy.c
@@ -7,6 +7,7 @@
*************************************************************************/
#include "pc_joy.h"
+#include "pc_joy_sw.h"
const device_type PC_JOY = &device_creator<pc_joy_device>;
@@ -86,4 +87,5 @@ pc_basic_joy_device::pc_basic_joy_device(const machine_config &mconfig, const ch
SLOT_INTERFACE_START(pc_joysticks)
SLOT_INTERFACE("basic_joy", PC_BASIC_JOY)
+ SLOT_INTERFACE("mssw_pad", PC_MSSW_PAD)
SLOT_INTERFACE_END
diff --git a/src/mess/machine/pc_joy_sw.c b/src/mess/machine/pc_joy_sw.c
new file mode 100644
index 00000000000..256834f3bdf
--- /dev/null
+++ b/src/mess/machine/pc_joy_sw.c
@@ -0,0 +1,177 @@
+//TODO: determine when to switch modes and add single bit mode
+
+#include "machine/pc_joy_sw.h"
+
+const device_type PC_MSSW_PAD = &device_creator<pc_mssw_pad_device>;
+
+pc_mssw_pad_device::pc_mssw_pad_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) :
+ device_t(mconfig, PC_MSSW_PAD, "Microsoft Sidewinder Pad", tag, owner, clock, "mssw_pad", __FILE__),
+ device_pc_joy_interface(mconfig, *this),
+ m_btn1(*this, "btn1"),
+ m_btn2(*this, "btn2"),
+ m_btn3(*this, "btn3"),
+ m_btn4(*this, "btn4"),
+ m_conf(*this, "CONFIG")
+{
+}
+
+void pc_mssw_pad_device::device_start()
+{
+ m_timer = timer_alloc();
+}
+
+void pc_mssw_pad_device::device_reset()
+{
+ m_count = 0;
+ m_state = 0xf;
+ m_active = false;
+ m_timer->adjust(attotime::never, 0);
+}
+
+void pc_mssw_pad_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
+{
+ UINT16 pad_state = 0;
+ // only multibit mode for now
+ if(m_count == -1)
+ {
+ reset();
+ return;
+ }
+
+ if((m_count / 5) > m_conf->read())
+ {
+ m_timer->adjust(attotime::from_usec(50), 0);
+ m_state &= ~1;
+ m_count = -1;
+ return;
+ }
+
+ if(m_state & 1)
+ {
+ m_state &= ~1;
+ return;
+ }
+
+ switch(m_count / 5)
+ {
+ case 0:
+ pad_state = m_btn1->read();
+ break;
+ case 1:
+ pad_state = m_btn2->read();
+ break;
+ case 2:
+ pad_state = m_btn3->read();
+ break;
+ case 3:
+ pad_state = m_btn4->read();
+ break;
+ }
+
+ switch(m_count % 5)
+ {
+ case 0:
+ m_state = ((pad_state & 7) << 1) | 1;
+ break;
+ case 1:
+ m_state = ((pad_state & 0x38) >> 2) | 1;
+ break;
+ case 2:
+ m_state = ((pad_state & 0x1c0) >> 5) | 1;
+ break;
+ case 3:
+ m_state = ((pad_state & 0xe00) >> 8) | 1;
+ break;
+ case 4:
+ {
+ UINT8 parity = (pad_state >> 8) ^ pad_state;
+ parity = (parity >> 4) ^ parity;
+ parity = (parity >> 2) ^ parity;
+ parity = (((parity >> 1) ^ parity) & 1);
+
+ m_state = ((pad_state & 0x3000) >> 11) | (parity << 3) | 1;
+ break;
+ }
+ }
+ m_count++;
+}
+
+static INPUT_PORTS_START( sidewinder_pad )
+ PORT_START("btn1")
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A")
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B")
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("C")
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("X")
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Y")
+ PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Z")
+ PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("L")
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("R")
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Start")
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("M")
+ PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_START("btn2")
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") PORT_PLAYER(2)
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") PORT_PLAYER(2)
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("C") PORT_PLAYER(2)
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("X") PORT_PLAYER(2)
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Y") PORT_PLAYER(2)
+ PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Z") PORT_PLAYER(2)
+ PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("L") PORT_PLAYER(2)
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("R") PORT_PLAYER(2)
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Start") PORT_PLAYER(2)
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("M") PORT_PLAYER(2)
+ PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_START("btn3")
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") PORT_PLAYER(3)
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") PORT_PLAYER(3)
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("C") PORT_PLAYER(3)
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("X") PORT_PLAYER(3)
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Y") PORT_PLAYER(3)
+ PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Z") PORT_PLAYER(3)
+ PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("L") PORT_PLAYER(3)
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("R") PORT_PLAYER(3)
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Start") PORT_PLAYER(3)
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("M") PORT_PLAYER(3)
+ PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_START("btn4")
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") PORT_PLAYER(4)
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") PORT_PLAYER(4)
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("C") PORT_PLAYER(4)
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("X") PORT_PLAYER(4)
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Y") PORT_PLAYER(4)
+ PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Z") PORT_PLAYER(4)
+ PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("L") PORT_PLAYER(4)
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("R") PORT_PLAYER(4)
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Start") PORT_PLAYER(4)
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("M") PORT_PLAYER(4)
+ PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_START("CONFIG")
+ PORT_CONFNAME(0x03, 0x00, "Number of Sidewinder Pads")
+ PORT_CONFSETTING( 0x00, "1")
+ PORT_CONFSETTING( 0x01, "2")
+ PORT_CONFSETTING( 0x02, "3")
+ PORT_CONFSETTING( 0x03, "4")
+INPUT_PORTS_END
+
+ioport_constructor pc_mssw_pad_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( sidewinder_pad );
+}
+
+
diff --git a/src/mess/machine/pc_joy_sw.h b/src/mess/machine/pc_joy_sw.h
new file mode 100644
index 00000000000..041ab8ad3dc
--- /dev/null
+++ b/src/mess/machine/pc_joy_sw.h
@@ -0,0 +1,36 @@
+#ifndef PC_JOY_SW_H_
+#define PC_JOY_SW_H_
+
+#include "machine/pc_joy.h"
+
+class pc_mssw_pad_device : public device_t,
+ public device_pc_joy_interface
+{
+public:
+ pc_mssw_pad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ioport_constructor device_input_ports() const;
+
+ virtual UINT8 btn() { return m_state; }
+ // timing is guessed, calibrated for at486
+ virtual void port_write() { if(!m_active) { m_timer->adjust(attotime::from_usec(50), 0, attotime::from_usec(5)); m_active = true; } }
+
+protected:
+ virtual void device_start();
+ virtual void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr);
+ virtual void device_reset();
+
+private:
+ required_ioport m_btn1;
+ required_ioport m_btn2;
+ required_ioport m_btn3;
+ required_ioport m_btn4;
+ required_ioport m_conf;
+ emu_timer *m_timer;
+ int m_count;
+ UINT8 m_state;
+ bool m_active;
+};
+
+extern const device_type PC_MSSW_PAD;
+
+#endif /* PC_JOY_SW_H_ */
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index 3a38646a81e..7db3acab11a 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -1542,6 +1542,7 @@ $(MESSOBJ)/pc9801.a: \
$(MESSOBJ)/pcshare.a: \
$(MESS_MACHINE)/pc_fdc.o \
$(MESS_MACHINE)/pc_joy.o \
+ $(MESS_MACHINE)/pc_joy_sw.o \
$(MESS_MACHINE)/pc_keyboards.o \
$(MESS_MACHINE)/kb_keytro.o \
$(MESS_MACHINE)/kb_msnat.o \