Previous 199869 Revisions Next

r20446 Thursday 24th January, 2013 at 19:13:00 UTC by Carl
[mess] finish modernizing pc joystick and remove tag lookups (nw)
[src/mess/drivers]amstr_pc.c pc.c
[src/mess/machine]pc_joy.c pc_joy.h

trunk/src/mess/drivers/pc.c
r20445r20446
195195   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
196196   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,            pc_page_w)
197197   AM_RANGE(0x00a0, 0x00a0) AM_WRITE(pc_nmi_enable_w )
198   AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r,              pc_JOY_w)
198   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
199199   AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc_rtc_r,             pc_rtc_w)
200200   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w)
201201   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_device, ins8250_r, ins8250_w)
r20445r20446
221221   AM_RANGE(0x0070, 0x007f) AM_RAM // needed for Poisk-2
222222   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
223223   AM_RANGE(0x00a0, 0x00a1) AM_WRITE8(pc_nmi_enable_w, 0x00ff )
224   AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
224   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
225225   AM_RANGE(0x0240, 0x0257) AM_READWRITE8(pc_rtc_r,                pc_rtc_w, 0xffff)
226226   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w, 0xffff)
227227   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
r20445r20446
296296   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xffff)
297297   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
298298   AM_RANGE(0x00a0, 0x00a1) AM_READWRITE8(unk_r, pc_nmi_enable_w, 0x00ff )
299   AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
299   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
300300   AM_RANGE(0x0240, 0x0257) AM_READWRITE8(pc_rtc_r,                pc_rtc_w, 0xffff)
301301   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w, 0xffff)
302302   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
r20445r20446
327327   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
328328   AM_RANGE(0x0060, 0x0063) AM_READWRITE_LEGACY(europc_pio_r,          europc_pio_w)
329329   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,            pc_page_w)
330   AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r,              pc_JOY_w)
330   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
331331   AM_RANGE(0x0250, 0x025f) AM_READWRITE_LEGACY(europc_jim_r,          europc_jim_w)
332332   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w)
333333   AM_RANGE(0x02e0, 0x02e0) AM_READ_LEGACY(europc_jim2_r)
r20445r20446
362362   AM_RANGE(0x0060, 0x0063) AM_READWRITE_LEGACY(tandy1000_pio_r,           tandy1000_pio_w)
363363   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,                pc_page_w)
364364   AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", ncr7496_device, write)
365   AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r,                  pc_JOY_w)
365   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
366366   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
367367   AM_RANGE(0x0378, 0x037f) AM_READWRITE_LEGACY(pc_t1t_p37x_r,         pc_t1t_p37x_w)
368368   AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w)
r20445r20446
392392   AM_RANGE(0x0060, 0x0063) AM_READWRITE8_LEGACY(tandy1000_pio_r,          tandy1000_pio_w, 0xffff)
393393   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
394394   AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496",    ncr7496_device, write, 0xffff)
395   AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r,                 pc_JOY_w, 0xffff)
395   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
396396   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
397397   AM_RANGE(0x0378, 0x037f) AM_READWRITE8_LEGACY(pc_t1t_p37x_r,            pc_t1t_p37x_w, 0xffff)
398398   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff)
r20445r20446
423423   AM_RANGE(0x0060, 0x0063) AM_READWRITE8_LEGACY(tandy1000_pio_r,         tandy1000_pio_w, 0xffff)
424424   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
425425   AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496", ncr7496_device, write, 0xffff)
426   AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r,                    pc_JOY_w, 0xffff)
426   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
427427   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
428428   AM_RANGE(0x0378, 0x037f) AM_READWRITE8_LEGACY(pc_t1t_p37x_r,           pc_t1t_p37x_w, 0xffff)
429429   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff)
r20445r20446
455455   AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", sn76496_device, write)
456456   AM_RANGE(0x00f2, 0x00f2) AM_WRITE(pcjr_fdc_dor_w)
457457   AM_RANGE(0x00f4, 0x00f5) AM_DEVICE("upd765", upd765a_device, map)
458   AM_RANGE(0x0200, 0x0207) AM_READWRITE_LEGACY(pc_JOY_r,                  pc_JOY_w)
458   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("joy", pc_joy_device, joy_port_r, joy_port_w)
459459   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
460460   AM_RANGE(0x0378, 0x037f) AM_READWRITE_LEGACY(pc_t1t_p37x_r,         pc_t1t_p37x_w)
461461   AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w)
r20445r20446
538538   PORT_BIT( 0x02, 0x02,   IPT_UNUSED ) /* no turbo switch */
539539   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
540540
541   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
542541   PORT_INCLUDE( pcvideo_cga )
543542INPUT_PORTS_END
544543
r20445r20446
607606   PORT_BIT( 0x02, 0x02,   IPT_UNUSED ) /* no turbo switch */
608607   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
609608
610   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
611609   PORT_INCLUDE( pcvideo_cga )
612610INPUT_PORTS_END
613611
r20445r20446
658656
659657   EUROPC_KEYBOARD
660658
661   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
662659   PORT_INCLUDE( pcvideo_cga )
663660INPUT_PORTS_END
664661
r20445r20446
730727   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
731728
732729//  PORT_INCLUDE( at_keyboard )     /* IN4 - IN11 */
733   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
734730   PORT_INCLUDE( pcvideo_cga )
735731INPUT_PORTS_END
736732
r20445r20446
770766   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
771767
772768   PORT_INCLUDE( t1000_keyboard )
773   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
774769INPUT_PORTS_END
775770
776771static INPUT_PORTS_START( ibmpcjr )
r20445r20446
999994   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
1000995   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
1001996   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
997   MCFG_PC_JOY_ADD("joy")
1002998
1003999   MCFG_PC_FDC_XT_ADD("fdc")
10041000
r20445r20446
10641060   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
10651061   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
10661062   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
1063   MCFG_PC_JOY_ADD("joy")
10671064
10681065   /* video hardware */
10691066   MCFG_FRAGMENT_ADD( pcvideo_aga )
r20445r20446
11301127   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
11311128   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
11321129   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1130   MCFG_PC_JOY_ADD("joy")
11331131
11341132   MCFG_PC_FDC_XT_ADD("fdc")
11351133
r20445r20446
11831181   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
11841182   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
11851183   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1184   MCFG_PC_JOY_ADD("joy")
11861185
11871186   MCFG_PC_FDC_XT_ADD("fdc")
11881187   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "35dd", 0, pc_state::floppy_formats)
r20445r20446
12311230   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
12321231   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
12331232   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1233   MCFG_PC_JOY_ADD("joy")
12341234
12351235   MCFG_PC_FDC_XT_ADD("fdc")
12361236   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "35dd", 0, pc_state::floppy_formats)
r20445r20446
12991299   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
13001300   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
13011301   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1302   MCFG_PC_JOY_ADD("joy")
13021303
13031304   /* cassette */
13041305   MCFG_CASSETTE_ADD( CASSETTE_TAG, ibm5150_cassette_interface )
r20445r20446
15391540   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
15401541   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
15411542   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1543   MCFG_PC_JOY_ADD("joy")
15421544
15431545   MCFG_PC_FDC_XT_ADD("fdc")
15441546
r20445r20446
15941596   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
15951597   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
15961598   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1599   MCFG_PC_JOY_ADD("joy")
15971600
15981601   MCFG_PC_FDC_XT_ADD("fdc")
15991602
r20445r20446
16481651   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
16491652   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
16501653   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1654   MCFG_PC_JOY_ADD("joy")
16511655
16521656   MCFG_PC_FDC_XT_ADD("fdc")
16531657
r20445r20446
17021706   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
17031707   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
17041708   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1709   MCFG_PC_JOY_ADD("joy")
17051710
17061711   MCFG_PC_FDC_XT_ADD("fdc")
17071712
r20445r20446
17561761   MCFG_PC_LPT_ADD("lpt_0", pc_lpt_config)
17571762   MCFG_PC_LPT_ADD("lpt_1", pc_lpt_config)
17581763   MCFG_PC_LPT_ADD("lpt_2", pc_lpt_config)
1764   MCFG_PC_JOY_ADD("joy")
17591765
17601766   MCFG_PC_FDC_XT_ADD("fdc")
17611767
trunk/src/mess/drivers/amstr_pc.c
r20445r20446
8888   AM_RANGE(0x0078, 0x0079) AM_READWRITE8_LEGACY(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff)
8989   AM_RANGE(0x007a, 0x007b) AM_READWRITE8_LEGACY(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff)
9090   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
91   AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
91   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
9292   AM_RANGE(0x0278, 0x027b) AM_READ8_LEGACY(pc200_port278_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_2", pc_lpt_w, 0x00ff)
9393   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
9494   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
r20445r20446
116116   AM_RANGE(0x0078, 0x0079) AM_READWRITE8_LEGACY(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff)
117117   AM_RANGE(0x007a, 0x007b) AM_READWRITE8_LEGACY(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff)
118118   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff)
119   AM_RANGE(0x0200, 0x0207) AM_READWRITE8_LEGACY(pc_JOY_r, pc_JOY_w, 0xffff)
119   AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff)
120120   AM_RANGE(0x0278, 0x027b) AM_READ8_LEGACY(pc200_port278_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_2", pc_lpt_w, 0x00ff)
121121   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r,  ins8250_w, 0xffff)
122122   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
r20445r20446
196196   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
197197
198198   PORT_INCLUDE( at_keyboard )     /* IN4 - IN11 */
199   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
200199
201200   PORT_START("VIDEO") /* IN20 */
202201   PORT_CONFNAME( 0x03, 0x03, "IDA character set")
r20445r20446
299298
300299   MCFG_PC_FDC_XT_ADD("fdc")
301300
301   MCFG_PC_JOY_ADD("joy")
302
302303   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)
303304   MCFG_FLOPPY_DRIVE_ADD("fdc:1", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)
304305
r20445r20446
370371
371372   MCFG_PC_FDC_XT_ADD("fdc")
372373
374   MCFG_PC_JOY_ADD("joy")
375
373376   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)
374377   MCFG_FLOPPY_DRIVE_ADD("fdc:1", ibmpc_floppies, "525dd", 0, ibmpc_floppy_formats)
375378
trunk/src/mess/machine/pc_joy.c
r20445r20446
99#include "emu.h"
1010#include "pc_joy.h"
1111
12
13static attotime JOY_time;
14
15
16READ8_HANDLER ( pc_JOY_r )
12READ8_MEMBER ( pc_joy_device::joy_port_r )
1713{
1814   UINT8 data = 0xf;
1915   int delta;
20   attotime new_time = space.machine().time();
21   ioport_port *joystick_port = space.machine().root_device().ioport("pc_joy");
22   delta = ((new_time - JOY_time) * 256 * 1000).seconds;
16   attotime new_time = machine().time();
17   delta = ((new_time - m_stime) * 256 * 1000).seconds;
2318
24   if (joystick_port != NULL)
25   {
26      data = joystick_port->read() ^ 0xf0;
19   data = m_btn->read() ^ 0xf0;
2720
28      /* timer overflow? Nope, otherwise some HWs can't verify the port properly */
29      //if ((new_time - JOY_time) > attotime::from_msec(10))
30      //{
31      //}
32      //else
33      {
34         if (space.machine().root_device().ioport("pc_joy_1")->read() < delta) data &= ~0x01;
35         if (space.machine().root_device().ioport("pc_joy_2")->read() < delta) data &= ~0x02;
36         if (space.machine().root_device().ioport("pc_joy_3")->read() < delta) data &= ~0x04;
37         if (space.machine().root_device().ioport("pc_joy_4")->read() < delta) data &= ~0x08;
38      }
39   }
40   else
41   {
42      data = 0xf0;
43      // TODO: find decay rate with no joystick connected
44   }
21   /* timer overflow? Nope, otherwise some HWs can't verify the port properly */
22   //if ((new_time - JOY_time) > attotime::from_msec(10))
23   //{
24   //}
25   //else
26
27   if (m_x1->read() < delta) data &= ~0x01;
28   if (m_y1->read() < delta) data &= ~0x02;
29   if (m_x2->read() < delta) data &= ~0x04;
30   if (m_y2->read() < delta) data &= ~0x08;
4531   return data;
4632}
4733
4834
4935
50WRITE8_HANDLER ( pc_JOY_w )
36WRITE8_MEMBER ( pc_joy_device::joy_port_w )
5137{
52   JOY_time = space.machine().time();
38   m_stime = machine().time();
5339}
5440
55INPUT_PORTS_START( pc_joystick_none )
56   PORT_START("pc_joy")
57   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
58   PORT_START("pc_joy_1")
59   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
60   PORT_START("pc_joy_2")
61   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
62   PORT_START("pc_joy_3")
63   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
64   PORT_START("pc_joy_4")
65   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
66INPUT_PORTS_END
67
68
69
70INPUT_PORTS_START( pc_joystick )
71   PORT_START("pc_joy")
41static INPUT_PORTS_START( pc_joystick )
42   PORT_START("btn")
7243   PORT_BIT ( 0xf, 0xf,     IPT_UNUSED )
7344   PORT_BIT( 0x0010, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1")
7445   PORT_BIT( 0x0020, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 1 Button 2")
7546   PORT_BIT( 0x0040, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2)
7647   PORT_BIT( 0x0080, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 2 Button 2") PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
7748
78   PORT_START("pc_joy_1")
49   PORT_START("x1")
7950   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)
8051
81   PORT_START("pc_joy_2")
52   PORT_START("y1")
8253   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)
8354
84   PORT_START("pc_joy_3")
55   PORT_START("x2")
8556   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)
8657
87   PORT_START("pc_joy_4")
58   PORT_START("y2")
8859   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)
8960INPUT_PORTS_END
9061
9162const device_type PC_JOY = &device_creator<pc_joy_device>;
9263
9364pc_joy_device::pc_joy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
94   : device_t(mconfig, PC_JOY, "PC joystick", tag, owner, clock)
65   : device_t(mconfig, PC_JOY, "PC joystick", tag, owner, clock),
66   m_btn(*this, "btn"),
67   m_x1(*this, "x1"),
68   m_y1(*this, "y1"),
69   m_x2(*this, "x2"),
70   m_y2(*this, "y2")
9571{
9672}
9773
trunk/src/mess/machine/pc_joy.h
r20445r20446
1111
1212#include "emu.h"
1313
14DECLARE_READ8_HANDLER ( pc_JOY_r );
15DECLARE_WRITE8_HANDLER ( pc_JOY_w );
16
17INPUT_PORTS_EXTERN( pc_joystick_none );
18INPUT_PORTS_EXTERN( pc_joystick );
19
2014#define MCFG_PC_JOY_ADD(_tag) \
2115   MCFG_DEVICE_ADD(_tag, PC_JOY, 0)
2216
r20445r20446
2620   pc_joy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2721   virtual ioport_constructor device_input_ports() const;
2822
29   DECLARE_READ8_MEMBER(joy_port_r) { return pc_JOY_r(space, offset); }
30   DECLARE_WRITE8_MEMBER(joy_port_w) { pc_JOY_w(space, offset, data); }
23   DECLARE_READ8_MEMBER(joy_port_r);
24   DECLARE_WRITE8_MEMBER(joy_port_w);
3125protected:
3226   virtual void device_start() {}
27
28private:
29   required_ioport m_btn;
30   required_ioport m_x1;
31   required_ioport m_y1;
32   required_ioport m_x2;
33   required_ioport m_y2;
34
35   attotime m_stime;
3336};
3437
3538extern const device_type PC_JOY;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team