Previous 199869 Revisions Next

r31804 Wednesday 27th August, 2014 at 11:15:37 UTC by Robbbert
atari_s2: sound for superman, hercules, roadrunner.
[src/mame/drivers]atari_s2.c hankin.c

trunk/src/mame/drivers/hankin.c
r31803r31804
472472      float vol = m_vol/16.666+0.1;
473473      m_dac->set_output_gain(0, vol);
474474   }
475
476475}
477476
478477// low to divide 555 by 2
trunk/src/mame/drivers/atari_s2.c
r31803r31804
88
99    The only difference seems to be an extra bank of inputs (or something) at 2008-200B.
1010
11ToDo:
12- 4x4 not emulated yet, appears to be a different cpu and hardware.
13- sounds to be verified against a real machine
14- noise generator not done yet
15- inputs, outputs, dips vary per machine
16- High score isn't saved or remembered
1117
18
1219*****************************************************************************************/
1320
1421#include "machine/genpin.h"
1522#include "cpu/m6800/m6800.h"
23#include "sound/dac.h"
1624#include "atari_s2.lh"
1725
1826
r31803r31804
2028{
2129public:
2230   atari_s2_state(const machine_config &mconfig, device_type type, const char *tag)
23      : genpin_class(mconfig, type, tag),
24   m_maincpu(*this, "maincpu")
31      : genpin_class(mconfig, type, tag)
32      , m_maincpu(*this, "maincpu")
33      , m_dac(*this, "dac")
2534   { }
2635
27   DECLARE_WRITE8_MEMBER(sound0_w) { };
28   DECLARE_WRITE8_MEMBER(sound1_w) { };
36   DECLARE_WRITE8_MEMBER(sound0_w);
37   DECLARE_WRITE8_MEMBER(sound1_w);
2938   DECLARE_WRITE8_MEMBER(lamp_w) { };
3039   DECLARE_WRITE8_MEMBER(sol0_w);
3140   DECLARE_WRITE8_MEMBER(sol1_w) { };
3241   DECLARE_WRITE8_MEMBER(intack_w);
3342   DECLARE_WRITE8_MEMBER(display_w);
3443   DECLARE_READ8_MEMBER(switch_r);
35
3644   TIMER_DEVICE_CALLBACK_MEMBER(irq);
37protected:
38
39   // devices
40   required_device<cpu_device> m_maincpu;
41
42   // driver_device overrides
43   virtual void machine_reset();
45   TIMER_DEVICE_CALLBACK_MEMBER(timer_s);
4446private:
47   bool m_timer_sb;
48   UINT8 m_timer_s[3];
49   UINT8 m_sound0;
50   UINT8 m_sound1;
51   UINT8 m_vol;
4552   UINT8 m_t_c;
4653   UINT8 m_segment[7];
54   UINT8 *m_p_prom;
55   virtual void machine_reset();
56   required_device<cpu_device> m_maincpu;
57   required_device<dac_device> m_dac;
4758};
4859
4960
r31803r31804
337348   return ioport(kbdrow)->read();
338349}
339350
351// Sound
352// 4 frequencies (500k,250k,125k,62.5k) come from main clock circuits
353// We choose one of these with SEL A,B
354// Then presettable 74LS161 binary divider controlled by m_sound0:d4-7
355// Then a 74LS393 to generate 5 address lines
356// The address lines are merged with m_sound0:d0-3 to form a lookup on the prom
357// Output of prom goes to a 4-bit DAC
358// Volume is controlled by m_sound1:d0-3
359// Variables:
360// m_timer_s[0] inc each timer cycle, bit 0 = 500k, bit 1 = 250k, bit 2 = 125k, bit 3 = 62.5k
361// m_timer_s[1] count in 74LS161
362// m_timer_s[2] count in 74LS393
363// m_timer_sb   wanted output of m_timer_s[0]
364TIMER_DEVICE_CALLBACK_MEMBER( atari_s2_state::timer_s )
365{
366   m_timer_s[0]++;
367   bool cs = BIT(m_timer_s[0], (m_sound0 & 0x30) >> 4); // select which frequency to work with by using SEL A,B
368   if (cs != m_timer_sb)
369   {
370      m_timer_sb = cs;
371      m_timer_s[1]++;
372      if (m_timer_s[1] > 15)
373      {
374         m_timer_s[1] = m_sound1; // set to preset value
375         m_timer_s[2]++;
376         offs_t offs = (m_timer_s[2] & 31) | ((m_sound0 & 15) << 5);
377         if BIT(m_sound0, 6)
378            m_dac->write_unsigned8(m_p_prom[offs]<< 4);
379      }
380   }
381}
382
383// d0-3 = sound data to prom
384// d4-5 = select initial clock frequency
385// d6 h = enable wave
386// d7 h = enable noise
387WRITE8_MEMBER( atari_s2_state::sound0_w )
388{
389   m_sound0 = data;
390   offs_t offs = (m_timer_s[2] & 31) | ((m_sound0 & 15) << 5);
391   if BIT(m_sound0, 6)
392      m_dac->write_unsigned8(m_p_prom[offs]<< 4);
393}
394
395// d0-3 = volume
396// d4-7 = preset on 74LS161
397WRITE8_MEMBER( atari_s2_state::sound1_w )
398{
399   m_sound1 = data >> 4;
400
401   data &= 15;
402
403   if (data != m_vol)
404   {
405      m_vol = data;
406      float vol = m_vol/16.666+0.1;
407      m_dac->set_output_gain(0, vol);
408   }
409}
410
340411TIMER_DEVICE_CALLBACK_MEMBER( atari_s2_state::irq )
341412{
342413   if (m_t_c > 0x40)
r31803r31804
347418
348419void atari_s2_state::machine_reset()
349420{
421   m_p_prom = memregion("proms")->base();
422   m_vol = 0;
423   m_sound0 = 0;
424   m_sound1 = 0;
350425}
351426
427
352428static MACHINE_CONFIG_START( atari_s2, atari_s2_state )
353429   /* basic machine hardware */
354430   MCFG_CPU_ADD("maincpu", M6800, XTAL_4MHz / 4)
355431   MCFG_CPU_PROGRAM_MAP(atari_s2_map)
356432   MCFG_NVRAM_ADD_0FILL("nvram")
357   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq", atari_s2_state, irq, attotime::from_hz(XTAL_4MHz / 8192))
358433
359434   /* Sound */
360435   MCFG_FRAGMENT_ADD( genpin_audio )
436   MCFG_SPEAKER_STANDARD_MONO("mono")
437   MCFG_SOUND_ADD("dac", DAC, 0)
438   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
361439
362440   /* Video */
363441   MCFG_DEFAULT_LAYOUT(layout_atari_s2)
442
443   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq", atari_s2_state, irq, attotime::from_hz(XTAL_4MHz / 8192))
444   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_s", atari_s2_state, timer_s, attotime::from_hz(150000))
364445MACHINE_CONFIG_END
365446
366447static MACHINE_CONFIG_DERIVED( atari_s3, atari_s2 )
r31803r31804
378459   ROM_LOAD("atari_m.rom", 0x3000, 0x0800, CRC(1bb6b72c) SHA1(dd24ed54de275aadf8dc0810a6af3ac97aea4026))
379460   ROM_LOAD("atari_j.rom", 0x3800, 0x0800, CRC(26521779) SHA1(2cf1c66441aee99b9d01859d495c12025b5ef094))
380461
381   ROM_REGION(0x1000, "sound1", 0)
462   ROM_REGION(0x0200, "proms", 0)
382463   ROM_LOAD("82s130.bin", 0x0000, 0x0200, CRC(da1f77b4) SHA1(b21fdc1c6f196c320ec5404013d672c35f95890b))
383464ROM_END
384465
r31803r31804
391472   ROM_LOAD("atari_m.rom", 0x3000, 0x0800, CRC(1bb6b72c) SHA1(dd24ed54de275aadf8dc0810a6af3ac97aea4026))
392473   ROM_LOAD("atari_j.rom", 0x3800, 0x0800, CRC(26521779) SHA1(2cf1c66441aee99b9d01859d495c12025b5ef094))
393474
394   ROM_REGION(0x1000, "sound1", 0)
475   ROM_REGION(0x0200, "proms", 0)
395476   ROM_LOAD("82s130.bin", 0x0000, 0x0200, CRC(da1f77b4) SHA1(b21fdc1c6f196c320ec5404013d672c35f95890b))
396477ROM_END
397478
r31803r31804
404485   ROM_LOAD("3000.716", 0x3000, 0x0800, CRC(2fc01359) SHA1(d3df20c764bb68a5316367bb18d34a03293e7fa6))
405486   ROM_LOAD("3800.716", 0x3800, 0x0800, CRC(77262408) SHA1(3045a732c39c96002f495f64ed752279f7d43ee7))
406487
407   ROM_REGION(0x1000, "sound1", 0)
488   ROM_REGION(0x0200, "proms", 0)
408489   ROM_LOAD("82s130.bin", 0x0000, 0x0200, CRC(da1f77b4) SHA1(b21fdc1c6f196c320ec5404013d672c35f95890b))
409490ROM_END
410491
r31803r31804
418499   ROM_LOAD("c000a70c.bin", 0xc000, 0x2000, CRC(c31ca8d3) SHA1(53f20eff0084771dc61d19db7ddae52e4423e75e)) \
419500   ROM_RELOAD(0xe000, 0x2000)
420501
421   ROM_REGION(0x1000, "sound1", 0)
502   ROM_REGION(0x0200, "proms", 0)
422503   ROM_LOAD("82s130.bin", 0x0000, 0x0200, CRC(da1f77b4) SHA1(b21fdc1c6f196c320ec5404013d672c35f95890b))
423504ROM_END
424505
425GAME( 1979, supermap,  0,  atari_s2,  atari_s2, driver_device, 0,  ROT0, "Atari", "Superman (Pinball)", GAME_MECHANICAL | GAME_NO_SOUND)
426GAME( 1979, hercules,  0,  atari_s2,  atari_s2, driver_device, 0,  ROT0, "Atari", "Hercules", GAME_MECHANICAL | GAME_NO_SOUND)
427GAME( 1979, roadrunr,  0,  atari_s3,  atari_s2, driver_device, 0,  ROT0, "Atari", "Road Runner", GAME_MECHANICAL | GAME_NO_SOUND)
428GAME( 1982, fourx4,    0,  atari_s2,  atari_s2, driver_device, 0,  ROT0, "Atari", "4x4", GAME_IS_SKELETON_MECHANICAL)
506GAME( 1979, supermap,  0,  atari_s2,  atari_s2, driver_device, 0,  ROT0, "Atari", "Superman (Pinball)", GAME_MECHANICAL | GAME_IMPERFECT_SOUND)
507GAME( 1979, hercules,  0,  atari_s2,  atari_s2, driver_device, 0,  ROT0, "Atari", "Hercules", GAME_MECHANICAL | GAME_IMPERFECT_SOUND)
508GAME( 1979, roadrunr,  0,  atari_s3,  atari_s2, driver_device, 0,  ROT0, "Atari", "Road Runner", GAME_MECHANICAL | GAME_IMPERFECT_SOUND)
509GAME( 1982, fourx4,    0,  atari_s3,  atari_s2, driver_device, 0,  ROT0, "Atari", "4x4", GAME_IS_SKELETON_MECHANICAL)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team