Previous 15994 Revisions Next

r9057 Monday 6th September, 2010 at 17:03:43 UTC by Angelo Salese
[PCE]: Hooked up 6 buttons controllers
[src/mess/drivers]pce.c
[src/mess/includes]pce.h
[src/mess/machine]pce.c

src/mess/machine/pce.c
r9056r9057
257257   pce_cd_init( machine );
258258}
259259
260static UINT8 joy_type[5],joy_6b_packet[5],joy_i;
261
262MACHINE_RESET( pce )
263{
264   joy_type[0] = (input_port_read(machine,"JOY_TYPE") & 0x01) >> 0;
265   joy_type[1] = (input_port_read(machine,"JOY_TYPE") & 0x02) >> 1;
266   joy_type[2] = (input_port_read(machine,"JOY_TYPE") & 0x04) >> 2;
267   joy_type[3] = (input_port_read(machine,"JOY_TYPE") & 0x08) >> 3;
268   joy_type[4] = (input_port_read(machine,"JOY_TYPE") & 0x10) >> 4;
269}
270
260271/* todo: how many input ports does the PCE have? */
261272WRITE8_HANDLER ( pce_joystick_w )
262273{
r9056r9057
274285    if(data & JOY_RESET)
275286    {
276287        joystick_port_select = 0;
288
289      for(joy_i=0;joy_i<5;joy_i++)
290      {
291         if(joy_type[joy_i] & 1)
292              joy_6b_packet[joy_i]^=1;
293      }
277294    }
278295}
279296
r9056r9057
283300   UINT8 ret;
284301   int data;
285302
286   if(joystick_port_select <= 4)
287      data = input_port_read(space->machine, joyname[joystick_port_select]);
303   if(joy_6b_packet[joystick_port_select])
304   {
305      if(joystick_port_select <= 4)
306         data = (input_port_read(space->machine, joyname[joystick_port_select]) >> 8) & 0x0f;
307      else
308         data = 0;
309   }
288310   else
289      data = 0xff;
290
311   {
312      if(joystick_port_select <= 4)
313         data = input_port_read(space->machine, joyname[joystick_port_select]);
314      else
315         data = 0xff;
316   }
291317   if(joystick_data_select) data >>= 4;
292318   ret = (data & 0x0F) | pce.io_port_options;
293319#ifdef UNIFIED_PCE
src/mess/includes/pce.h
r9056r9057
5050DRIVER_INIT( tg16 );
5151DRIVER_INIT( sgx );
5252MACHINE_START( pce );
53MACHINE_RESET( pce );
5354
5455
5556#endif /* PCE_H_ */
src/mess/drivers/pce.c
r9056r9057
120120
121121    PORT_START("JOY_P1")  /* Player 1 controls */
122122    /* II is left of I on the original pad so we map them in reverse order */
123    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1)
124    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1)
125    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_PLAYER(1)
126    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P1 Run") PORT_PLAYER(1)
127    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
128    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
129    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
130    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
123    PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1)
124    PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1)
125    PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_NAME("P1 Select") PORT_PLAYER(1)
126    PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P1 Run") PORT_PLAYER(1)
127    PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
128    PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
129    PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
130    PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
131    PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Button III") PORT_PLAYER(1)
132    PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Button IV") PORT_PLAYER(1)
133    PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Button V") PORT_PLAYER(1)
134    PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Button VI") PORT_PLAYER(1)
131135
132136    PORT_START("JOY_P2")  /* Player 2 controls */
133137    /* II is left of I on the original pad so we map them in reverse order */
134    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2)
135    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2)
136    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_PLAYER(2)
137    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P2 Run") PORT_PLAYER(2)
138    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
139    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
140    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
141    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
138    PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2)
139    PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2)
140    PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_NAME("P2 Select") PORT_PLAYER(2)
141    PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P2 Run") PORT_PLAYER(2)
142    PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
143    PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
144    PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
145    PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
146    PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Button III") PORT_PLAYER(2)
147    PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Button IV") PORT_PLAYER(2)
148    PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Button V") PORT_PLAYER(2)
149    PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Button VI") PORT_PLAYER(2)
142150
143151    PORT_START("JOY_P3")  /* Player 3 controls */
144152    /* II is left of I on the original pad so we map them in reverse order */
145    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3)
146    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3)
147    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_PLAYER(3)
148    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P3 Run") PORT_PLAYER(3)
149    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
150    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
151    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
152    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
153    PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3)
154    PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3)
155    PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_NAME("P3 Select") PORT_PLAYER(3)
156    PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P3 Run") PORT_PLAYER(3)
157    PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
158    PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
159    PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
160    PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
161    PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(3)
162    PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(3)
163    PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(3)
164    PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(3)
153165
154    PORT_START("JOY_P4")  /* Player 1 controls */
166    PORT_START("JOY_P4")  /* Player 4 controls */
155167    /* II is left of I on the original pad so we map them in reverse order */
156    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4)
157    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4)
158    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_PLAYER(4)
159    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P4 Run") PORT_PLAYER(4)
160    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
161    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
162    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
163    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
168    PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4)
169    PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4)
170    PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_NAME("P4 Select") PORT_PLAYER(4)
171    PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P4 Run") PORT_PLAYER(4)
172    PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
173    PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
174    PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
175    PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
176    PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P3 Button III") PORT_PLAYER(4)
177    PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P3 Button IV") PORT_PLAYER(4)
178    PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P3 Button V") PORT_PLAYER(4)
179    PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(4)
164180
165    PORT_START("JOY_P5")  /* Player 1 controls */
181    PORT_START("JOY_P5")  /* Player 5 controls */
166182    /* II is left of I on the original pad so we map them in reverse order */
167    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5)
168    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5)
169    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_PLAYER(5)
170    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P5 Run") PORT_PLAYER(5)
171    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5)
172    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5)
173    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5)
174    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5)
183    PORT_BIT( 0x001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5)
184    PORT_BIT( 0x002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5)
185    PORT_BIT( 0x004, IP_ACTIVE_LOW, IPT_SELECT  ) PORT_NAME("P5 Select") PORT_PLAYER(5)
186    PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_START   ) PORT_NAME("P5 Run") PORT_PLAYER(5)
187    PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(5)
188    PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(5)
189    PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5)
190    PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5)
191    PORT_BIT( 0x100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P5 Button III") PORT_PLAYER(5)
192    PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P5 Button IV") PORT_PLAYER(5)
193    PORT_BIT( 0x400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P5 Button V") PORT_PLAYER(5)
194    PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P5 Button VI") PORT_PLAYER(5)
195
196   PORT_START("JOY_TYPE")
197   PORT_CONFNAME(0x01,0x00,"Joystick Type Player 1")
198   PORT_CONFSETTING(0x00,"2-buttons")
199   PORT_CONFSETTING(0x01,"6-buttons")
200   PORT_CONFNAME(0x02,0x00,"Joystick Type Player 2")
201   PORT_CONFSETTING(0x00,"2-buttons")
202   PORT_CONFSETTING(0x02,"6-buttons")
203   PORT_CONFNAME(0x04,0x00,"Joystick Type Player 3")
204   PORT_CONFSETTING(0x00,"2-buttons")
205   PORT_CONFSETTING(0x04,"6-buttons")
206   PORT_CONFNAME(0x08,0x00,"Joystick Type Player 4")
207   PORT_CONFSETTING(0x00,"2-buttons")
208   PORT_CONFSETTING(0x08,"6-buttons")
209   PORT_CONFNAME(0x10,0x00,"Joystick Type Player 5")
210   PORT_CONFSETTING(0x00,"2-buttons")
211   PORT_CONFSETTING(0x10,"6-buttons")
175212#if 0
176213    PORT_START  /* Fake dipswitches for system config */
177214    PORT_DIPNAME( 0x01, 0x01, "Console type")
r9056r9057
240277   MDRV_QUANTUM_TIME(HZ(60))
241278
242279   MDRV_MACHINE_START( pce )
280   MDRV_MACHINE_RESET( pce )
243281
244282    /* video hardware */
245283   MDRV_SCREEN_ADD("screen", RASTER)
r9056r9057
290328   MDRV_QUANTUM_TIME(HZ(60))
291329
292330   MDRV_MACHINE_START( pce )
331   MDRV_MACHINE_RESET( pce )
293332
294333   /* video hardware */
295334   MDRV_SCREEN_ADD("screen", RASTER)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team