trunk/src/mame/drivers/atari_s2.c
| r31805 | r31806 | |
| 11 | 11 | ToDo: |
| 12 | 12 | - 4x4 not emulated yet, appears to be a different cpu and hardware. |
| 13 | 13 | - 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. |
| 15 | 16 | - inputs, outputs, dips vary per machine |
| 16 | 17 | - High score isn't saved or remembered |
| 17 | 18 | |
| r31805 | r31806 | |
| 31 | 32 | : genpin_class(mconfig, type, tag) |
| 32 | 33 | , m_maincpu(*this, "maincpu") |
| 33 | 34 | , m_dac(*this, "dac") |
| 35 | , m_dac1(*this, "dac1") |
| 34 | 36 | { } |
| 35 | 37 | |
| 36 | 38 | DECLARE_WRITE8_MEMBER(sound0_w); |
| r31805 | r31806 | |
| 45 | 47 | TIMER_DEVICE_CALLBACK_MEMBER(timer_s); |
| 46 | 48 | private: |
| 47 | 49 | bool m_timer_sb; |
| 48 | | UINT8 m_timer_s[3]; |
| 50 | bool m_ab1; |
| 51 | UINT8 m_timer_s[5]; |
| 49 | 52 | UINT8 m_sound0; |
| 50 | 53 | UINT8 m_sound1; |
| 51 | 54 | UINT8 m_vol; |
| r31805 | r31806 | |
| 55 | 58 | virtual void machine_reset(); |
| 56 | 59 | required_device<cpu_device> m_maincpu; |
| 57 | 60 | required_device<dac_device> m_dac; |
| 61 | required_device<dac_device> m_dac1; |
| 58 | 62 | }; |
| 59 | 63 | |
| 60 | 64 | |
| r31805 | r31806 | |
| 356 | 360 | // The address lines are merged with m_sound0:d0-3 to form a lookup on the prom |
| 357 | 361 | // Output of prom goes to a 4-bit DAC |
| 358 | 362 | // Volume is controlled by m_sound1:d0-3 |
| 363 | // Noise is a pair of 74LS164 shift registers, connected to form a pseudo-random pattern |
| 359 | 364 | // Variables: |
| 360 | 365 | // m_timer_s[0] inc each timer cycle, bit 0 = 500k, bit 1 = 250k, bit 2 = 125k, bit 3 = 62.5k |
| 361 | 366 | // m_timer_s[1] count in 74LS161 |
| 362 | 367 | // 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 |
| 363 | 370 | // m_timer_sb wanted output of m_timer_s[0] |
| 364 | 371 | TIMER_DEVICE_CALLBACK_MEMBER( atari_s2_state::timer_s ) |
| 365 | 372 | { |
| r31805 | r31806 | |
| 371 | 378 | m_timer_s[1]++; |
| 372 | 379 | if (m_timer_s[1] > 15) |
| 373 | 380 | { |
| 381 | // wave |
| 374 | 382 | m_timer_s[1] = m_sound1; // set to preset value |
| 375 | 383 | m_timer_s[2]++; |
| 376 | 384 | offs_t offs = (m_timer_s[2] & 31) | ((m_sound0 & 15) << 5); |
| 377 | 385 | if BIT(m_sound0, 6) |
| 378 | 386 | 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 | } |
| 379 | 395 | } |
| 380 | 396 | } |
| 381 | 397 | } |
| r31805 | r31806 | |
| 405 | 421 | m_vol = data; |
| 406 | 422 | float vol = m_vol/16.666+0.1; |
| 407 | 423 | m_dac->set_output_gain(0, vol); |
| 424 | m_dac1->set_output_gain(0, vol); |
| 408 | 425 | } |
| 409 | 426 | } |
| 410 | 427 | |
| r31805 | r31806 | |
| 436 | 453 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 437 | 454 | MCFG_SOUND_ADD("dac", DAC, 0) |
| 438 | 455 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 456 | MCFG_SOUND_ADD("dac1", DAC, 0) |
| 457 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 439 | 458 | |
| 440 | 459 | /* Video */ |
| 441 | 460 | MCFG_DEFAULT_LAYOUT(layout_atari_s2) |