trunk/src/mame/drivers/segaufo.c
r241570 | r241571 | |
73 | 73 | ufo_state(const machine_config &mconfig, device_type type, const char *tag) |
74 | 74 | : driver_device(mconfig, type, tag), |
75 | 75 | m_maincpu(*this, "maincpu"), |
| 76 | m_io1(*this, "io1"), |
| 77 | m_io2(*this, "io2"), |
76 | 78 | m_upd(*this, "upd") |
77 | 79 | { } |
78 | 80 | |
79 | 81 | required_device<cpu_device> m_maincpu; |
| 82 | required_device<sega_315_5296_device> m_io1; |
| 83 | required_device<sega_315_5296_device> m_io2; |
80 | 84 | optional_device<upd7759_device> m_upd; |
81 | 85 | |
82 | 86 | struct Player |
r241570 | r241571 | |
113 | 117 | |
114 | 118 | |
115 | 119 | |
116 | | |
117 | 120 | void ufo_state::motor_tick(int p, int m) |
118 | 121 | { |
119 | 122 | float delta = m_player[p].motor[m].speed; |
r241570 | r241571 | |
139 | 142 | |
140 | 143 | TIMER_DEVICE_CALLBACK_MEMBER(ufo_state::update_info) |
141 | 144 | { |
142 | | ; |
| 145 | #if 0 |
| 146 | char msg1[0x100]={0}; |
| 147 | char msg2[0x100]={0}; |
| 148 | for (int i = 0; i < 8; i++) |
| 149 | { |
| 150 | sprintf(msg2, "%02X ", m_io2->debug_peek_output(i)); |
| 151 | strcat(msg1, msg2); |
| 152 | } |
| 153 | for (int i = 0; i < 4; i++) |
| 154 | { |
| 155 | sprintf(msg2, "\n%d %05f", i, m_player[0].motor[i].position); |
| 156 | strcat(msg1, msg2); |
| 157 | } |
| 158 | popmessage("%s", msg1); |
| 159 | #endif |
143 | 160 | } |
144 | 161 | |
145 | 162 | |
| 163 | |
146 | 164 | /*************************************************************************** |
147 | 165 | |
148 | 166 | I/O |
r241570 | r241571 | |
246 | 264 | READ8_MEMBER(ufo_state::crane_limits_r) |
247 | 265 | { |
248 | 266 | int p = offset & 1; |
249 | | UINT8 ret = 0xff; |
| 267 | UINT8 ret = 0x7f; |
250 | 268 | |
251 | 269 | // d0: left limit sw (right for p2) |
252 | 270 | // d1: right limit sw (left for p2) |
r241570 | r241571 | |
264 | 282 | if (m_player[p].motor[3].position >= 0.97) |
265 | 283 | ret ^= 0x40; |
266 | 284 | |
267 | | // d7: ? |
| 285 | // d7: prize sensor (mirror?) |
| 286 | ret |= (ioport(p ? "P2" : "P1")->read() & 0x80); |
268 | 287 | |
269 | 288 | return ret; |
270 | 289 | } |
271 | 290 | |
272 | 291 | |
273 | 292 | |
274 | | |
275 | 293 | static ADDRESS_MAP_START( ufo_map, AS_PROGRAM, 8, ufo_state ) |
276 | 294 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
277 | 295 | AM_RANGE(0xe000, 0xffff) AM_RAM |
r241570 | r241571 | |
294 | 312 | |
295 | 313 | ***************************************************************************/ |
296 | 314 | |
297 | | static INPUT_PORTS_START( ufo ) |
| 315 | static INPUT_PORTS_START( newufo ) |
298 | 316 | PORT_START("P1") |
299 | 317 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_NAME("P1 Coin 1") |
300 | 318 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_NAME("P1 Coin 2") |
r241570 | r241571 | |
354 | 372 | PORT_DIPNAME( 0x08, 0x08, "UNK2-08" ) |
355 | 373 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
356 | 374 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
357 | | PORT_DIPNAME( 0x10, 0x10, "UNK2-10 Enable Prize Sensor" ) |
| 375 | PORT_DIPNAME( 0x10, 0x10, "UNK2-10 Disable Prize Sensor" ) |
358 | 376 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
359 | 377 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
360 | 378 | PORT_DIPNAME( 0x20, 0x20, "UNK2-20" ) |
r241570 | r241571 | |
368 | 386 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
369 | 387 | INPUT_PORTS_END |
370 | 388 | |
| 389 | static INPUT_PORTS_START( ufomini ) |
| 390 | PORT_INCLUDE( newufo ) |
371 | 391 | |
| 392 | PORT_MODIFY("P2") |
| 393 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 394 | INPUT_PORTS_END |
372 | 395 | |
| 396 | |
| 397 | |
373 | 398 | /*************************************************************************** |
374 | 399 | |
375 | 400 | Machine Config |
r241570 | r241571 | |
414 | 439 | m_maincpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); |
415 | 440 | } |
416 | 441 | |
417 | | static MACHINE_CONFIG_START( ufo, ufo_state ) |
| 442 | static MACHINE_CONFIG_START( newufo, ufo_state ) |
418 | 443 | |
419 | 444 | /* basic machine hardware */ |
420 | 445 | MCFG_CPU_ADD("maincpu", Z80, 8000000) |
r241570 | r241571 | |
428 | 453 | // all ports set to input |
429 | 454 | MCFG_315_5296_IN_PORTA_CB(READ8(ufo_state, crane_limits_r)) |
430 | 455 | MCFG_315_5296_IN_PORTB_CB(READ8(ufo_state, crane_limits_r)) |
431 | | // MCFG_315_5296_IN_PORTC_CB(NOOP) |
432 | | // MCFG_315_5296_IN_PORTD_CB(NOOP) |
433 | 456 | MCFG_315_5296_IN_PORTE_CB(IOPORT("P1")) |
434 | 457 | MCFG_315_5296_IN_PORTF_CB(IOPORT("DSW1")) |
435 | 458 | MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW2")) |
r241570 | r241571 | |
444 | 467 | MCFG_315_5296_OUT_PORTE_CB(WRITE8(ufo_state, crane_xyz_w)) |
445 | 468 | MCFG_315_5296_OUT_PORTF_CB(WRITE8(ufo_state, crane_xyz_w)) |
446 | 469 | MCFG_315_5296_OUT_PORTG_CB(WRITE8(ufo_state, ufo_lamps_w)) |
447 | | // MCFG_315_5296_OUT_PORTH_CB(NOOP) |
448 | 470 | |
449 | 471 | MCFG_DEVICE_ADD("pit", PIT8254, 0) // uPD71054C, configuration is unknown |
450 | 472 | MCFG_PIT8253_CLK0(8000000/256) |
r241570 | r241571 | |
465 | 487 | MCFG_SOUND_ROUTE(1, "mono", 0.40) |
466 | 488 | MACHINE_CONFIG_END |
467 | 489 | |
| 490 | static MACHINE_CONFIG_DERIVED( ufomini, newufo ) |
468 | 491 | |
| 492 | /* basic machine hardware */ |
| 493 | MCFG_DEVICE_MODIFY("io1") |
| 494 | MCFG_315_5296_IN_PORTC_CB(IOPORT("P1")) |
| 495 | MCFG_315_5296_IN_PORTE_CB(NOOP) |
| 496 | MCFG_315_5296_IN_PORTH_CB(NOOP) |
| 497 | MACHINE_CONFIG_END |
469 | 498 | |
| 499 | |
| 500 | |
470 | 501 | /*************************************************************************** |
471 | 502 | |
472 | 503 | Game drivers |
r241570 | r241571 | |
514 | 545 | ROM_END |
515 | 546 | |
516 | 547 | |
517 | | GAMEL( 1991, newufo, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (standard)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
518 | | GAMEL( 1991, newufo_sonic, newufo, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Sonic The Hedgehog)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
519 | | GAMEL( 1991, newufo_nfl, newufo, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Team NFL)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
520 | | GAMEL( 1991, newufo_xmas, newufo, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Christmas season ROM kit)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
521 | | GAMEL( 1991, ufomini, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "UFO Catcher Mini", GAME_NOT_WORKING | GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
522 | | GAMEL( 1996, ufo21, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "UFO Catcher 21", GAME_NOT_WORKING | GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
523 | | GAMEL( 1998, ufo800, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "UFO Catcher 800", GAME_NOT_WORKING | GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
| 548 | GAMEL( 1991, newufo, 0, newufo, newufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (standard)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
| 549 | GAMEL( 1991, newufo_sonic, newufo, newufo, newufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Sonic The Hedgehog)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
| 550 | GAMEL( 1991, newufo_nfl, newufo, newufo, newufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Team NFL)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
| 551 | GAMEL( 1991, newufo_xmas, newufo, newufo, newufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Christmas season ROM kit)", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
| 552 | GAMEL( 1991, ufomini, 0, ufomini, ufomini, driver_device, 0, ROT0, "Sega", "UFO Catcher Mini", GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
| 553 | GAMEL( 1996, ufo21, 0, newufo, newufo, driver_device, 0, ROT0, "Sega", "UFO Catcher 21", GAME_NOT_WORKING | GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |
| 554 | GAMEL( 1998, ufo800, 0, newufo, newufo, driver_device, 0, ROT0, "Sega", "UFO Catcher 800", GAME_NOT_WORKING | GAME_MECHANICAL | GAME_SUPPORTS_SAVE, layout_segaufo ) |