•  Back 
  •  Hardware 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-File
                                STe/TT DMA Sound


The Atari STe, Mega STe, TT030, and Falcon030 are all equipped with the
ability to playback stereo digital audio. Only the Falcon030, however, has
supporting XBIOS calls which eliminate the need for the programmer to
directly access the sound system hardware. Although the Falcon030 has
a more sophisticated sound system than the earlier Atari machines, the
hardware registers have been kept compatible so older applications should
function as expected. Programmers designing Falcon030 applications which
use digital audio should use the appropriate XBIOS calls.

The STe, Mega STe, and TT030 support 8-bit monophonic or stereophonic
sound samples. Samples should be signed (-128 to 127) with alternating
left and right channels (for stereo) beginning with the left channel.
Samples may be played at 50 kHz, 25 kHz, 12.5 kHz, or 6.25 kHz (6.25 kHz
is not supported on the Falcon030).

DMA Sound Registers

Several hardware registers control DMA sound output as follows:

Address       Bit Layout             Meaning

0x00FF8900    ---- ---- ---- --cc    Sound DMA Control
              ---- ---- ---- ttmm    Falcon030 is enhanced

0x00FF8902    ---- ---- 00xx xxxx    Frame Base Address High (bits 21-16)

0x00FF8904    ---- ---- xxxx xxxx    Frame Base Address Middle (bits 15-8)

0x00FF8906    ---- ---- xxxx xxx0    Frame Base Address Low (bits 7-1)

0x00FF8908    ---- ---- 00xx xxxx    Frame Address Counter (bits 21-16)

0x00FF890A    ---- ---- xxxx xxxx    Frame Address Counter (bits 15-8)

0x00FF890C    ---- ---- xxxx xxx0    Frame Address Counter (bits 7-1)

0x00FF890E    ---- ---- 00xx xxxx    Frame End Address High (bits 21-16)

0x00FF8910    ---- ---- xxxx xxxx    Frame End Address Middle (bits 15-8)

0x00FF8912    ---- ---- xxxx xxx0    Frame End Address Low (bits 7-1)

0x00FF8920    0000 0000 m000 00rr    Sound Mode Control

Addresses placed in the three groups of address pointer registers must
begin on an even address. In addition, only sounds within the first 4
megabytes of memory may be accessed (this limitation has been lifted on
the Falcon030). Sounds may not be played from alternate RAM.

Playing a Sound

To begin sound playback, place the start address of the sound in the
Frame Base Address registers. Place the address of the end of the sound in
the Frame End Address registers. The address of the end of the sound
should actually be the first byte in memory past the last byte of the
sample.

Set the Sound Mode Control register to the proper value. Bit 7, notated
as 'm' should be set to 1 for a monophonic sample or 0 for a stereophonic
sample. Bits 0 and 1, notated as 'r', control the sample playback rate as
follows:

 'r'   Playback Rate

  00   6258 Hz

  01   12517 Hz

  10   25033 Hz

  11   50066 Hz

To begin the sample playback, set bits 0 and 1 of the Sound DMA Control
register, notated as 'c',  as follows:

 'c'   Sound Control

  00   Sound Disabled (this will stop any sound currently being played)

  01   Sound Enabled (play once)

  11   Sound Enabled (repeat until stopped)

Sound playback may be prematurely halted by writing a 0 to address
0x00FF8900.

Sound Interrupts using MFP Timer A

Discontinuous sample frames may be linked together using the MFP Timer
A interrupt. When a sound is played using repeat mode an interrupt is
generated at the end of every frame. By configuring Timer A to 'event
count' mode you can ensure the seamless linkage and variable repeating of
frames.
For example, suppose you have three sample frames, A, B, and C, in memory
and you want to play A five times, B five times, and C only once. Use the
following steps to properly configure Timer A and achieve the desired
result:

∙ Use Xbtimer() to set Timer A to event count mode with a data value of 4
  (the first data value should be one less than actually desired since the
  sound will play once before the interrupt occurs).

∙ Configure the sound registers as desired and start sound playback in
  repeat mode.

∙ When the interrupt fires, place the address of frame B in the sound
  playback registers (these values aren't actually used until the current
  frame finishes).

∙ Reset Timer A's data register to 5 and exit your interrupt handler.

∙ When the second interrupt fires, place the address of frame C in the
  sound playback registers.

∙ Reset Timer A's data register to 1 and exit your interrupt handler.

∙ When the final interrupt is triggered, write a 0x01 to the sound control
  register to cause sound playback to end at the end of the current frame.

Sound Interrupts using GPIP 7

Another method of generating interrupts at the end of sound frames is by
using the MFP's General Purpose Interrupt Port (GPIP) 7. This interrupt
does not support an event count mode so it will generate an interrupt at
the end of every frame. In addition, the interrupt must be configured
differently depending on the type on monitor connected to the system (this
is because GPIP 7 serves double-duty as the monochrome detect signal).

To program GPIP 7 for interrupts, disable all DMA sound by placing a 0x00
in the sound control register. Next, check bit 7 of the GPIP port at
location 0xFFFA01. If a monochrome monitor is connected the bit will be 0.
The bit will be 1 if a color monitor is connected.

Bit 7 of the MFP's active edge register (at 0xFFFA03) should be set to
the opposite of the GPIP port's bit 7. This will cause an interrupt to
trigger at the end of every frame. Use Mfpint() to set the location of
your interrupt handler and Jenabint() to enable interrupts. From this
point, interrupts will be generated at the end of every frame playing in
'play once' mode or repeat mode until the interrupt is disabled.