Previous 199869 Revisions Next

r19084 Tuesday 20th November, 2012 at 23:03:48 UTC by hap
preliminary support for starfire sound samples
[src/mame/drivers]starfire.c
[src/mame/includes]starfire.h

trunk/src/mame/drivers/starfire.c
r19083r19084
4646
4747#include "emu.h"
4848#include "cpu/z80/z80.h"
49#include "sound/samples.h"
4950#include "includes/starfire.h"
5051
5152
r19083r19084
9697
9798WRITE8_MEMBER(starfire_state::starfire_sound_w)
9899{
99   // TODO: sound
100   // starfire sound samples (preliminary)
101   UINT8 rise = data & ~m_prev_sound;
102   m_prev_sound = data;
103
104   // d0: rumble
105   if (rise & 1) m_samples->start(0, 0, true);
106   if (~data & 1) m_samples->stop(0);
107
108   // d1: explosion
109   // d2: tie weapon
110   // d3: laser
111   if (rise & 2) m_samples->start(1, 1);
112   if (rise & 4) m_samples->start(2, 2);
113   if (rise & 8) m_samples->start(3, 3);
114
115   // these are from the same generator (called "computer" in schematics)
116   // d4: track
117   // d5: lock
118   // d6: scanner
119   // d7: overheat
120   if (rise & 0x80) m_samples->start(4, 7);
121   else if (rise & 0x40) m_samples->start(4, 6);
122   else if (rise & 0x20) m_samples->start(4, 5);
123   else if (rise & 0x10) m_samples->start(4, 4);
100124}
101125
102WRITE8_MEMBER(starfire_state::fireone_io2_w)
126WRITE8_MEMBER(starfire_state::fireone_sound_w)
103127{
104128   // TODO: sound
105129   m_fireone_select = (data & 0x8) ? 0 : 1;
r19083r19084
111135   switch (offset & 15)
112136   {
113137      case 0: return ioport("DSW")->read();
114      case 1: return ioport("SYSTEM")->read();   /* Note: need to loopback sounds lengths on that one */
138      case 1:
139      {
140         // d3 and d4 come from the audio circuit, how does it work exactly?
141         // tie_on sounds ok, but laser_on sounds buggy
142         UINT8 tie_on = m_samples->playing(2) ? 0x00 : 0x08;
143         UINT8 laser_on = m_samples->playing(3) ? 0x00 : 0x10;
144         UINT8 input = ioport("SYSTEM")->read() & 0xe7;
145         return input | tie_on | laser_on | 0x10; // disable laser_on for now
146      }
115147      case 5: return ioport("STICKZ")->read();
116148      case 6: return ioport("STICKX")->read();
117149      case 7: return ioport("STICKY")->read();
r19083r19084
269301 *
270302 *************************************/
271303
304static const char *const starfire_sample_names[] =
305{
306   "*starfire",
307   "size",
308   "explosion",
309   "tie",
310   "laser",
311   "track",
312   "lock",
313   "scanner",
314   "overheat",
315   0
316};
317
318static const samples_interface starfire_samples_interface =
319{
320   5,   /* 5 channels */
321   starfire_sample_names
322};
323
324
272325INTERRUPT_GEN_MEMBER(starfire_state::vblank_int)
273326{
274327   // starfire has a jumper for disabling NMI, used to do a complete RAM test
r19083r19084
276329      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
277330}
278331
279static MACHINE_CONFIG_START( starfire, starfire_state )
280332
333static MACHINE_CONFIG_START( fireone, starfire_state )
334
281335   /* basic machine hardware */
282336   MCFG_CPU_ADD("maincpu", Z80, STARFIRE_CPU_CLOCK)
283337   MCFG_CPU_PROGRAM_MAP(main_map)
r19083r19084
288342   MCFG_SCREEN_RAW_PARAMS(STARFIRE_PIXEL_CLOCK, STARFIRE_HTOTAL, STARFIRE_HBEND, STARFIRE_HBSTART, STARFIRE_VTOTAL, STARFIRE_VBEND, STARFIRE_VBSTART)
289343   MCFG_SCREEN_UPDATE_DRIVER(starfire_state, screen_update_starfire)
290344
291   /* audio hardware */
345   /* sound hardware */
292346MACHINE_CONFIG_END
293347
294348
349static MACHINE_CONFIG_DERIVED( starfire, fireone )
295350
351   /* sound hardware */
352   MCFG_SPEAKER_STANDARD_MONO("mono")
353
354   MCFG_SAMPLES_ADD("samples", starfire_samples_interface)
355   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
356MACHINE_CONFIG_END
357
358
359
296360/*************************************
297361 *
298362 *  ROM definitions
r19083r19084
390454{
391455   m_input_read = read8_delegate(FUNC(starfire_state::starfire_input_r),this);
392456   m_io2_write = write8_delegate(FUNC(starfire_state::starfire_sound_w),this);
457
458   /* register for state saving */
459   save_item(NAME(m_prev_sound));
393460}
394461
395462DRIVER_INIT_MEMBER(starfire_state,fireone)
396463{
397464   m_input_read = read8_delegate(FUNC(starfire_state::fireone_input_r),this);
398   m_io2_write = write8_delegate(FUNC(starfire_state::fireone_io2_w),this);
465   m_io2_write = write8_delegate(FUNC(starfire_state::fireone_sound_w),this);
399466
400467   /* register for state saving */
401468   save_item(NAME(m_fireone_select));
r19083r19084
409476 *
410477 *************************************/
411478
412GAME( 1979, starfire, 0,        starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 1)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
413GAME( 1979, starfirea,starfire, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 2)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
414GAME( 1979, fireone,  0,        starfire, fireone,  starfire_state, fireone,  ROT0, "Exidy", "Fire One", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
415GAME( 1979, starfir2, 0,        starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire 2", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
479GAME( 1979, starfire, 0,        starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
480GAME( 1979, starfirea,starfire, starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire (set 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
481GAME( 1979, fireone,  0,        fireone,  fireone,  starfire_state, fireone,  ROT0, "Exidy", "Fire One", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
482GAME( 1979, starfir2, 0,        starfire, starfire, starfire_state, starfire, ROT0, "Exidy", "Star Fire 2", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/starfire.h
r19083r19084
44
55***************************************************************************/
66
7#include "sound/samples.h"
8
9
710#define STARFIRE_MASTER_CLOCK   (XTAL_20MHz)
811#define STARFIRE_CPU_CLOCK      (STARFIRE_MASTER_CLOCK / 8)
912#define STARFIRE_PIXEL_CLOCK   (STARFIRE_MASTER_CLOCK / 4)
r19083r19084
1518#define STARFIRE_VBSTART      (0x100)
1619#define   STARFIRE_NUM_PENS       (0x40)
1720
21
1822class starfire_state : public driver_device
1923{
2024public:
2125   starfire_state(const machine_config &mconfig, device_type type, const char *tag)
2226      : driver_device(mconfig, type, tag),
2327      m_starfire_colorram(*this, "colorram"),
24      m_starfire_videoram(*this, "videoram")
28      m_starfire_videoram(*this, "videoram"),
29      m_samples(*this, "samples")
2530   { }
2631
2732   required_shared_ptr<UINT8> m_starfire_colorram;
2833   required_shared_ptr<UINT8> m_starfire_videoram;
34   optional_device<samples_device> m_samples;
2935
36   UINT8 m_prev_sound;
3037   UINT8 m_fireone_select;
3138
3239    UINT8 m_starfire_vidctrl;
r19083r19084
4451   DECLARE_READ8_MEMBER(starfire_input_r);
4552   DECLARE_READ8_MEMBER(fireone_input_r);
4653   DECLARE_WRITE8_MEMBER(starfire_sound_w);
47   DECLARE_WRITE8_MEMBER(fireone_io2_w);
54   DECLARE_WRITE8_MEMBER(fireone_sound_w);
4855   DECLARE_WRITE8_MEMBER(starfire_colorram_w);
4956   DECLARE_READ8_MEMBER(starfire_colorram_r);
5057   DECLARE_WRITE8_MEMBER(starfire_videoram_w);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team