trunk/src/mame/includes/homerun.h
| r17769 | r17770 | |
| 5 | 5 | *************************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #include "sound/upd7759.h" |
| 8 | #include "sound/samples.h" |
| 8 | 9 | |
| 9 | 10 | class homerun_state : public driver_device |
| 10 | 11 | { |
| r17769 | r17770 | |
| 14 | 15 | m_maincpu(*this, "maincpu"), |
| 15 | 16 | m_videoram(*this, "videoram"), |
| 16 | 17 | m_spriteram(*this, "spriteram"), |
| 17 | | m_d7756(*this, "d7756") |
| 18 | m_d7756(*this, "d7756"), |
| 19 | m_samples(*this, "samples") |
| 18 | 20 | { } |
| 19 | 21 | |
| 20 | 22 | required_device<cpu_device> m_maincpu; |
| 21 | 23 | required_shared_ptr<UINT8> m_videoram; |
| 22 | 24 | required_shared_ptr<UINT8> m_spriteram; |
| 23 | 25 | optional_device<upd7756_device> m_d7756; |
| 26 | optional_device<samples_device> m_samples; |
| 24 | 27 | |
| 25 | 28 | UINT8 m_control; |
| 29 | UINT8 m_sample; |
| 26 | 30 | |
| 27 | 31 | tilemap_t *m_tilemap; |
| 28 | 32 | int m_gfx_ctrl; |
| r17769 | r17770 | |
| 41 | 45 | |
| 42 | 46 | DECLARE_CUSTOM_INPUT_MEMBER(homerun_40_r); |
| 43 | 47 | DECLARE_CUSTOM_INPUT_MEMBER(homerun_d7756_busy_r); |
| 48 | DECLARE_CUSTOM_INPUT_MEMBER(ganjaja_d7756_busy_r); |
| 44 | 49 | DECLARE_CUSTOM_INPUT_MEMBER(ganjaja_hopper_status_r); |
| 45 | 50 | |
| 46 | 51 | TILE_GET_INFO_MEMBER(get_homerun_tile_info); |
trunk/src/mame/drivers/homerun.c
| r17769 | r17770 | |
| 49 | 49 | #include "machine/i8255.h" |
| 50 | 50 | #include "sound/2203intf.h" |
| 51 | 51 | #include "sound/upd7759.h" |
| 52 | #include "sound/samples.h" |
| 52 | 53 | #include "includes/homerun.h" |
| 53 | 54 | |
| 54 | 55 | |
| r17769 | r17770 | |
| 69 | 70 | upd7759_reset_w(m_d7756, ~data & 0x20); |
| 70 | 71 | upd7759_start_w(m_d7756, ~data & 0x10); |
| 71 | 72 | } |
| 73 | if (m_samples != NULL) |
| 74 | { |
| 75 | // play MAME sample if a dump of the internal rom does not exist |
| 76 | if (data & 0x20 & ~m_control) |
| 77 | m_samples->stop(0); |
| 72 | 78 | |
| 79 | if (~data & 0x10 & m_control) |
| 80 | { |
| 81 | samples_iterator iter(*m_samples); |
| 82 | if (m_sample < iter.count()) |
| 83 | m_samples->start(0, m_sample); |
| 84 | } |
| 85 | } |
| 86 | |
| 73 | 87 | // other bits: ? |
| 74 | 88 | m_control = data; |
| 75 | 89 | } |
| 76 | 90 | |
| 77 | 91 | WRITE8_MEMBER(homerun_state::homerun_d7756_sample_w) |
| 78 | 92 | { |
| 93 | m_sample = data; |
| 94 | |
| 79 | 95 | if (m_d7756 != NULL) |
| 80 | 96 | upd7759_port_w(m_d7756, 0, data); |
| 81 | 97 | } |
| r17769 | r17770 | |
| 110 | 126 | |
| 111 | 127 | CUSTOM_INPUT_MEMBER(homerun_state::homerun_d7756_busy_r) |
| 112 | 128 | { |
| 129 | return m_samples->playing(0) ? 0 : 1; |
| 130 | } |
| 131 | |
| 132 | CUSTOM_INPUT_MEMBER(homerun_state::ganjaja_d7756_busy_r) |
| 133 | { |
| 113 | 134 | return upd7759_busy_r(m_d7756); |
| 114 | 135 | } |
| 115 | 136 | |
| r17769 | r17770 | |
| 203 | 224 | PORT_START("IN0") |
| 204 | 225 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // ? |
| 205 | 226 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 206 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homerun_state, homerun_d7756_busy_r, NULL) |
| 227 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homerun_state, ganjaja_d7756_busy_r, NULL) |
| 207 | 228 | PORT_BIT( 0x76, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 208 | 229 | |
| 209 | 230 | PORT_START("IN1") |
| r17769 | r17770 | |
| 244 | 265 | |
| 245 | 266 | ***************************************************************************/ |
| 246 | 267 | |
| 268 | // homerun samples, note that this is the complete rom contents |
| 269 | // not all samples are used in this game |
| 270 | static const char *const homerun_sample_names[] = |
| 271 | { |
| 272 | "*homerun", |
| 273 | "00", // strike |
| 274 | "01", // ball |
| 275 | "02", // time (ask for time out) |
| 276 | "03", // out |
| 277 | "04", // safe |
| 278 | "05", // foul |
| 279 | "06", // yah (field player catching a fast ball) |
| 280 | "07", // batter out (batter out after 3 strikes) |
| 281 | "08", // play ball |
| 282 | "09", // ball four |
| 283 | "10", // home run |
| 284 | "11", // new pitcher (choosing new pitcher in time out) |
| 285 | "12", // ouch (batter gets hit by pitcher) |
| 286 | "13", // aho (be called a fool by supervisor) |
| 287 | "14", // bat hits ball |
| 288 | "15", // crowd cheers |
| 289 | 0 |
| 290 | }; |
| 291 | |
| 292 | static const samples_interface homerun_samples_interface = |
| 293 | { |
| 294 | 1, |
| 295 | homerun_sample_names |
| 296 | }; |
| 297 | |
| 298 | /**************************************************************************/ |
| 299 | |
| 247 | 300 | static const gfx_layout gfxlayout = |
| 248 | 301 | { |
| 249 | 302 | 8,8, |
| r17769 | r17770 | |
| 308 | 361 | state->membank("bank1")->configure_entries(1, 7, &ROM[0x10000], 0x4000); |
| 309 | 362 | |
| 310 | 363 | state->save_item(NAME(state->m_control)); |
| 364 | state->save_item(NAME(state->m_sample)); |
| 311 | 365 | state->save_item(NAME(state->m_gfx_ctrl)); |
| 312 | 366 | state->save_item(NAME(state->m_gc_up)); |
| 313 | 367 | state->save_item(NAME(state->m_gc_down)); |
| r17769 | r17770 | |
| 320 | 374 | homerun_state *state = machine.driver_data<homerun_state>(); |
| 321 | 375 | |
| 322 | 376 | state->m_control = 0; |
| 377 | state->m_sample = 0; |
| 323 | 378 | state->m_gfx_ctrl = 0; |
| 324 | 379 | state->m_gc_up = 0; |
| 325 | 380 | state->m_gc_down = 0; |
| r17769 | r17770 | |
| 368 | 423 | /* sound hardware */ |
| 369 | 424 | MCFG_SOUND_ADD("d7756", UPD7756, UPD7759_STANDARD_CLOCK) |
| 370 | 425 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 426 | |
| 427 | MCFG_SAMPLES_ADD("samples", homerun_samples_interface) |
| 428 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 371 | 429 | MACHINE_CONFIG_END |
| 372 | 430 | |
| 373 | | static MACHINE_CONFIG_DERIVED( ganjaja, homerun ) |
| 431 | static MACHINE_CONFIG_DERIVED( ganjaja, dynashot ) |
| 374 | 432 | |
| 375 | 433 | /* basic machine hardware */ |
| 376 | 434 | MCFG_CPU_MODIFY("maincpu") |
| 377 | 435 | MCFG_CPU_PERIODIC_INT(irq0_line_hold, 4*60) // ? |
| 436 | |
| 437 | /* sound hardware */ |
| 438 | MCFG_SOUND_ADD("d7756", UPD7756, UPD7759_STANDARD_CLOCK) |
| 439 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 378 | 440 | MACHINE_CONFIG_END |
| 379 | 441 | |
| 380 | 442 | |