trunk/src/mame/drivers/segaufo.c
r241567 | r241568 | |
47 | 47 | #include "machine/pit8253.h" |
48 | 48 | #include "machine/315_5296.h" |
49 | 49 | #include "sound/2612intf.h" |
| 50 | #include "sound/upd7759.h" |
50 | 51 | |
| 52 | #include "segaufo.lh" |
51 | 53 | |
| 54 | |
52 | 55 | /* simulation parameters */ |
53 | 56 | // x/y/z cabinet dimensions per player (motor range) |
54 | 57 | #define CABINET_WIDTH 400 |
r241567 | r241568 | |
69 | 72 | public: |
70 | 73 | ufo_state(const machine_config &mconfig, device_type type, const char *tag) |
71 | 74 | : driver_device(mconfig, type, tag), |
72 | | m_maincpu(*this, "maincpu") |
| 75 | m_maincpu(*this, "maincpu"), |
| 76 | m_upd(*this, "upd") |
73 | 77 | { } |
74 | 78 | |
75 | 79 | required_device<cpu_device> m_maincpu; |
| 80 | optional_device<upd7759_device> m_upd; |
76 | 81 | |
77 | 82 | struct Player |
78 | 83 | { |
r241567 | r241568 | |
103 | 108 | virtual void machine_reset(); |
104 | 109 | virtual void machine_start(); |
105 | 110 | TIMER_DEVICE_CALLBACK_MEMBER(simulate_xyz); |
| 111 | TIMER_DEVICE_CALLBACK_MEMBER(update_info); |
106 | 112 | }; |
107 | 113 | |
108 | 114 | |
r241567 | r241568 | |
123 | 129 | m_player[p].motor[m].position = 1; |
124 | 130 | } |
125 | 131 | |
126 | | |
127 | 132 | TIMER_DEVICE_CALLBACK_MEMBER(ufo_state::simulate_xyz) |
128 | 133 | { |
129 | 134 | for (int p = 0; p < 2; p++) |
r241567 | r241568 | |
131 | 136 | motor_tick(p, m); |
132 | 137 | } |
133 | 138 | |
| 139 | |
| 140 | TIMER_DEVICE_CALLBACK_MEMBER(ufo_state::update_info) |
| 141 | { |
| 142 | ; |
| 143 | } |
| 144 | |
| 145 | |
134 | 146 | /*************************************************************************** |
135 | 147 | |
136 | 148 | I/O |
r241567 | r241568 | |
144 | 156 | |
145 | 157 | WRITE_LINE_MEMBER(ufo_state::pit_out1) |
146 | 158 | { |
147 | | // ? |
| 159 | // NMI? |
| 160 | if (state) |
| 161 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
148 | 162 | } |
149 | 163 | |
150 | 164 | WRITE_LINE_MEMBER(ufo_state::pit_out2) |
151 | 165 | { |
152 | | // NMI? |
153 | | if (state) |
154 | | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 166 | // ? |
155 | 167 | } |
156 | 168 | |
157 | 169 | |
r241567 | r241568 | |
370 | 382 | |
371 | 383 | void ufo_state::machine_start() |
372 | 384 | { |
373 | | // init/zerofill |
| 385 | // init/zerofill/register for savestates |
374 | 386 | static const float motor_speeds[4] = |
375 | 387 | { 1.0f/CABINET_WIDTH, 1.0f/CABINET_DEPTH, 1.0f/CABINET_HEIGHT, 1.0f/CRANE_SIZE }; |
376 | 388 | |
377 | | for (int p = 0; p < 2; p++) |
| 389 | for (int m = 0; m < 4; m++) |
378 | 390 | { |
379 | | for (int m = 0; m < 4; m++) |
| 391 | for (int p = 0; p < 2; p++) |
380 | 392 | { |
381 | 393 | m_player[p].motor[m].running = 0; |
382 | 394 | m_player[p].motor[m].direction = 0; |
383 | 395 | m_player[p].motor[m].position = 0.5; |
384 | 396 | m_player[p].motor[m].speed = motor_speeds[m]; |
385 | 397 | } |
| 398 | |
| 399 | save_item(NAME(m_player[0].motor[m].running), m); |
| 400 | save_item(NAME(m_player[0].motor[m].direction), m); |
| 401 | save_item(NAME(m_player[0].motor[m].position), m); |
| 402 | |
| 403 | save_item(NAME(m_player[1].motor[m].running), m); |
| 404 | save_item(NAME(m_player[1].motor[m].direction), m); |
| 405 | save_item(NAME(m_player[1].motor[m].position), m); |
386 | 406 | } |
| 407 | |
| 408 | m_stepper = 0; |
| 409 | save_item(NAME(m_stepper)); |
387 | 410 | } |
388 | 411 | |
389 | 412 | WRITE_LINE_MEMBER(ufo_state::ym3438_irq) |
r241567 | r241568 | |
399 | 422 | MCFG_CPU_IO_MAP(ufo_portmap) |
400 | 423 | |
401 | 424 | MCFG_TIMER_DRIVER_ADD_PERIODIC("motor_timer", ufo_state, simulate_xyz, attotime::from_hz(MOTOR_SPEED)) |
| 425 | MCFG_TIMER_DRIVER_ADD_PERIODIC("update_timer", ufo_state, update_info, attotime::from_hz(60)) |
402 | 426 | |
403 | 427 | MCFG_DEVICE_ADD("io1", SEGA_315_5296, 16000000) |
404 | 428 | // all ports set to input |
r241567 | r241568 | |
490 | 514 | ROM_END |
491 | 515 | |
492 | 516 | |
493 | | GAME (1991, newufo, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (standard)", GAME_MECHANICAL ) |
494 | | GAME (1991, newufo_sonic, newufo, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Sonic The Hedgehog)", GAME_MECHANICAL ) |
495 | | GAME (1991, newufo_nfl, newufo, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Team NFL)", GAME_MECHANICAL ) |
496 | | GAME (1991, newufo_xmas, newufo, ufo, ufo, driver_device, 0, ROT0, "Sega", "New UFO Catcher (Christmas season ROM kit)", GAME_MECHANICAL ) |
497 | | GAME (1991, ufomini, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "UFO Catcher Mini", GAME_NOT_WORKING | GAME_MECHANICAL ) |
498 | | GAME (1996, ufo21, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "UFO Catcher 21", GAME_NOT_WORKING | GAME_MECHANICAL ) |
499 | | GAME (1998, ufo800, 0, ufo, ufo, driver_device, 0, ROT0, "Sega", "UFO Catcher 800", GAME_NOT_WORKING | GAME_MECHANICAL ) |
| 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 ) |