Previous 199869 Revisions Next

r31806 Wednesday 27th August, 2014 at 12:51:17 UTC by Robbbert
atari_s2: added noise circuit, although it doesn't seem to be used.
[src/mame/drivers]atari_s2.c

trunk/src/mame/drivers/atari_s2.c
r31805r31806
1111ToDo:
1212- 4x4 not emulated yet, appears to be a different cpu and hardware.
1313- sounds to be verified against a real machine
14- noise generator not done yet
14- noise generator sounds like a loud barrrr instead of noise, fortunately it
15  doesn't seem to be used.
1516- inputs, outputs, dips vary per machine
1617- High score isn't saved or remembered
1718
r31805r31806
3132      : genpin_class(mconfig, type, tag)
3233      , m_maincpu(*this, "maincpu")
3334      , m_dac(*this, "dac")
35      , m_dac1(*this, "dac1")
3436   { }
3537
3638   DECLARE_WRITE8_MEMBER(sound0_w);
r31805r31806
4547   TIMER_DEVICE_CALLBACK_MEMBER(timer_s);
4648private:
4749   bool m_timer_sb;
48   UINT8 m_timer_s[3];
50   bool m_ab1;
51   UINT8 m_timer_s[5];
4952   UINT8 m_sound0;
5053   UINT8 m_sound1;
5154   UINT8 m_vol;
r31805r31806
5558   virtual void machine_reset();
5659   required_device<cpu_device> m_maincpu;
5760   required_device<dac_device> m_dac;
61   required_device<dac_device> m_dac1;
5862};
5963
6064
r31805r31806
356360// The address lines are merged with m_sound0:d0-3 to form a lookup on the prom
357361// Output of prom goes to a 4-bit DAC
358362// Volume is controlled by m_sound1:d0-3
363// Noise is a pair of 74LS164 shift registers, connected to form a pseudo-random pattern
359364// Variables:
360365// m_timer_s[0] inc each timer cycle, bit 0 = 500k, bit 1 = 250k, bit 2 = 125k, bit 3 = 62.5k
361366// m_timer_s[1] count in 74LS161
362367// m_timer_s[2] count in 74LS393
368// m_timer_s[3] shift register of 74LS164 P4
369// m_timer_s[4] shift register of 74LS164 N4
363370// m_timer_sb   wanted output of m_timer_s[0]
364371TIMER_DEVICE_CALLBACK_MEMBER( atari_s2_state::timer_s )
365372{
r31805r31806
371378      m_timer_s[1]++;
372379      if (m_timer_s[1] > 15)
373380      {
381         // wave
374382         m_timer_s[1] = m_sound1; // set to preset value
375383         m_timer_s[2]++;
376384         offs_t offs = (m_timer_s[2] & 31) | ((m_sound0 & 15) << 5);
377385         if BIT(m_sound0, 6)
378386            m_dac->write_unsigned8(m_p_prom[offs]<< 4);
387         // noise
388         if BIT(m_sound0, 7)
389         {
390            m_timer_s[3] = (m_timer_s[3] << 1) | m_ab1;
391            m_timer_s[4] = (m_timer_s[4] << 1) | !BIT(m_timer_s[3], 1);
392            m_ab1 = BIT(m_timer_s[3], 0) ^ BIT(m_timer_s[4], 6);
393            m_dac1->write_unsigned8((m_timer_s[4] & 7)<< 5);
394         }
379395      }
380396   }
381397}
r31805r31806
405421      m_vol = data;
406422      float vol = m_vol/16.666+0.1;
407423      m_dac->set_output_gain(0, vol);
424      m_dac1->set_output_gain(0, vol);
408425   }
409426}
410427
r31805r31806
436453   MCFG_SPEAKER_STANDARD_MONO("mono")
437454   MCFG_SOUND_ADD("dac", DAC, 0)
438455   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
456   MCFG_SOUND_ADD("dac1", DAC, 0)
457   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
439458
440459   /* Video */
441460   MCFG_DEFAULT_LAYOUT(layout_atari_s2)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team