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