Previous 199869 Revisions Next

r17770 Monday 10th September, 2012 at 01:11:10 UTC by hap
add external samples for homerun
[src/mame/drivers]homerun.c
[src/mame/includes]homerun.h

trunk/src/mame/includes/homerun.h
r17769r17770
55*************************************************************************/
66
77#include "sound/upd7759.h"
8#include "sound/samples.h"
89
910class homerun_state : public driver_device
1011{
r17769r17770
1415      m_maincpu(*this, "maincpu"),
1516      m_videoram(*this, "videoram"),
1617      m_spriteram(*this, "spriteram"),
17      m_d7756(*this, "d7756")
18      m_d7756(*this, "d7756"),
19      m_samples(*this, "samples")
1820   { }
1921
2022   required_device<cpu_device> m_maincpu;
2123   required_shared_ptr<UINT8> m_videoram;
2224   required_shared_ptr<UINT8> m_spriteram;
2325   optional_device<upd7756_device> m_d7756;
26   optional_device<samples_device> m_samples;
2427
2528   UINT8 m_control;
29   UINT8 m_sample;
2630
2731   tilemap_t *m_tilemap;
2832   int m_gfx_ctrl;
r17769r17770
4145
4246   DECLARE_CUSTOM_INPUT_MEMBER(homerun_40_r);
4347   DECLARE_CUSTOM_INPUT_MEMBER(homerun_d7756_busy_r);
48   DECLARE_CUSTOM_INPUT_MEMBER(ganjaja_d7756_busy_r);
4449   DECLARE_CUSTOM_INPUT_MEMBER(ganjaja_hopper_status_r);
4550
4651   TILE_GET_INFO_MEMBER(get_homerun_tile_info);
trunk/src/mame/drivers/homerun.c
r17769r17770
4949#include "machine/i8255.h"
5050#include "sound/2203intf.h"
5151#include "sound/upd7759.h"
52#include "sound/samples.h"
5253#include "includes/homerun.h"
5354
5455
r17769r17770
6970      upd7759_reset_w(m_d7756, ~data & 0x20);
7071      upd7759_start_w(m_d7756, ~data & 0x10);
7172   }
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);
7278
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
7387   // other bits: ?
7488   m_control = data;
7589}
7690
7791WRITE8_MEMBER(homerun_state::homerun_d7756_sample_w)
7892{
93   m_sample = data;
94
7995   if (m_d7756 != NULL)
8096      upd7759_port_w(m_d7756, 0, data);
8197}
r17769r17770
110126
111127CUSTOM_INPUT_MEMBER(homerun_state::homerun_d7756_busy_r)
112128{
129   return m_samples->playing(0) ? 0 : 1;
130}
131
132CUSTOM_INPUT_MEMBER(homerun_state::ganjaja_d7756_busy_r)
133{
113134   return upd7759_busy_r(m_d7756);
114135}
115136
r17769r17770
203224   PORT_START("IN0")
204225   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // ?
205226   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)
207228   PORT_BIT( 0x76, IP_ACTIVE_HIGH, IPT_UNKNOWN )
208229
209230   PORT_START("IN1")
r17769r17770
244265
245266***************************************************************************/
246267
268// homerun samples, note that this is the complete rom contents
269// not all samples are used in this game
270static 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
292static const samples_interface homerun_samples_interface =
293{
294   1,
295   homerun_sample_names
296};
297
298/**************************************************************************/
299
247300static const gfx_layout gfxlayout =
248301{
249302   8,8,
r17769r17770
308361   state->membank("bank1")->configure_entries(1, 7, &ROM[0x10000], 0x4000);
309362
310363   state->save_item(NAME(state->m_control));
364   state->save_item(NAME(state->m_sample));
311365   state->save_item(NAME(state->m_gfx_ctrl));
312366   state->save_item(NAME(state->m_gc_up));
313367   state->save_item(NAME(state->m_gc_down));
r17769r17770
320374   homerun_state *state = machine.driver_data<homerun_state>();
321375
322376   state->m_control = 0;
377   state->m_sample = 0;
323378   state->m_gfx_ctrl = 0;
324379   state->m_gc_up = 0;
325380   state->m_gc_down = 0;
r17769r17770
368423   /* sound hardware */
369424   MCFG_SOUND_ADD("d7756", UPD7756, UPD7759_STANDARD_CLOCK)
370425   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)
371429MACHINE_CONFIG_END
372430
373static MACHINE_CONFIG_DERIVED( ganjaja, homerun )
431static MACHINE_CONFIG_DERIVED( ganjaja, dynashot )
374432
375433   /* basic machine hardware */
376434   MCFG_CPU_MODIFY("maincpu")
377435   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)
378440MACHINE_CONFIG_END
379441
380442

Previous 199869 Revisions Next


© 1997-2024 The MAME Team