STE documentation
4.
DMA-Sound - the simple
way to make music
Registers:
DMA-Sound
Control Register:
$FFFF8900
0 0 0 0 0 0 0
0 0 0 0 0 0 0 X X
Writing
a "00" to
the last 2 bits terminate
DMA sound replay.
Bit
0 controls Replay off/on,
Bit 1 controls Loop
off/on (0=off, 1=on).
DMA-Sound
Start Address Register:
$FFFF8902
0 0 X X X X X
X X X X X X X X X Hibyte
$FFFF8904
X X X X X X X
X X X X X X X X X Midbyte
$FFFF8906
X X X X X X X
X X X X X X X X 0 Lowbyte
These
three registers contain
the 24-bit address of
the sample to play.
Even though the samples
are built on a byte-base,
the DMA chip also
only allows even addresses
DMA-Sound
Count Register:
$FFFF8908
0 0 X X X X X
X X X X X X X X X Hibyte
(ro)
$FFFF890A
X X X X X X X
X X X X X X X X X Midbyte
(ro)
$FFFF890C
X X X X X X X
X X X X X X X X 0 Lowbyte
(ro)
Used
internally for the DMA-soundchip
to count from start-
to end-address.
No write access.
DMA-Sound
End Register:
$FFFF890E
0 0 X X X X X
X X X X X X X X X Hibyte
$FFFF8910
X X X X X X X
X X X X X X X X X Midbyte
$FFFF8912
X X X X X X X
X X X X X X X X 0 Lowbyte
The
address that the sample
ends at. When the count
registers have
reached this address,
the DMA-sound system
will either stop
or loop.
DMA-Soundmode
Register:
$FFFF8920
0 0 0 0 0 0 0
0 X 0 0 0 X X X X
Allows
to toggle between several
replay methods. Bit
7 switches Mono/Stereo
(1 = Mono, 0 = Stereo), Bit
0 and 1 encode the replay
rate:
0
0 - 6258
Hz
0
1 - 12517 Hz
1
0 - 25033 Hz
1
1 - 50066 Hz
Sounds
fairly easy, right ?
Unfortunately, it's
not.
?
I set all the registers,
but there is no sound
at all.
!
The DMA-Soundsystem
expects you to write
the high-byte of the Start-
and Endaddress first.
Even though this serves
no purpose at all,
writing the highbyte
clears the others. Hence it
must be written first.
?
I can't hear anything
on my Falcon when trying
to replay a 6 KHz
sample.
!
The Falcon DMA-soundsystem
does not support 6 KHz.
The value "00"
in the Soundmode-register
means "OFF"
on the Falcon.
?
The sound is awful.
This does not sound
like my sample.
!
On the STE, the DMA-soundsystem
only works with signed
sample files, featuring
values from -128 over
0 to +127. Some sample programs
use unsigned formats,
ranging from 0 to 255
with 128 representing
zero-line of the sample.
Those samples need to
be converted first.
?
I want to replay stereo
samples. How can i know
which sample will
be played on which channel
?
!
Stereo Samples have
to be organized wordwise
like Lowbyte ->
right channel
Hibyte
-> left channel
?
My STE program to replay
samples does not work
very well on the Falcon.
!
No, the Falcon's soundsystem
is way more complex
and can without any
major programming interfere
very well with the parts
of the STE-soundsystem,
especially since identical
addresses are used for some
purposes. If you want
Falcon-compatibility
of your STE-code, do
not use "move"-instructions
to set/unset bits of
$FFFF8900 and $FFFF8920
as this might override
Falcon-specific registers. Best,
leave them as they are
and use AND to unset
and OR to set certain
bits.
?
Will my STE code work
on the TT ?
!
Yes, it will. The TT's
DMA-sound subsystem
is identical to the
one of the STE.
?
I am trying to change
the addresses of the
sample while the DMA-sound
plays, but it does not
work.
!
No, the DMA-Soundsystem
latches the Start- and
End-Register internally,
so writing to these
values only takes influence when
the values are re-read,
which happens when the
sample has been
played, even if the
DMA-soundsystem is switched
to loop.
?
Argh, i have now implemented
DMA-sound to my program
and now my whole
screen-management goes
wild
!
This easily happens.
The DMA-sound subsystem
of the STE houses the
"shifting logic"
in the STE-Shifter.
When starting the DMA sound
to play a sample, you
should not try to access
the Shifter's registers
directly afterwards
but "wait"
a few cycles. The simplest
solution is to wait
a single VBL after starting the
DMA-sound before proceeding
with your program. Once
the DMA-sound plays,
you can change DMA-sound
registers without risking
to screw up screen management.
?
Can i get a "notice"
from the DMA-soundsystem
when it finished playing
a sample ?
!
Yes, you can use TIMER
A as event counter which
will be notified when
a sample has been played
completely.
?
I want to replay a sample
backwards.
!
Does not work on the
STE. The sample-counter
can only be increased,
not decreased.
5.
The National LMC 1992
and the Microwire
Preface:
There's
a little, but common
mistake of minor importance
when it comes to
this combo that allows
manipulation of the
DMA sound to enhance
trebble and bass as
well as left, right
and main volume. It
is not the Microwire
interface that manipulates
the sound, it is a chip
named National LMC 1992. This
chip however has not
been integrated into
the Atari STE hardware
directly but can only
be communicated with
using a 3-bit serial
interface, the so-called
Microwire. It is
a bit hard to handle
for a beginner, but
luckily, it is also
hard to crash the STE
using this register. And
since the Microwire
can basically connect
more than just one device,
it needs a 2 bit address
to which device to transfer
data to. The LMC1992
is at "address"
2 (binary 10). Each
address-data-pack written
to the LMC1992 therefore
consists of an 11 bit
package. The communication
is a bit similar to
communicating with the
YM2149 since the
Microwire also requires
to encode data in a
certain way.
National
LMC 1992
Adress
and Data register
$FFFF8922
x x x x x
x x x x x x x
x x x x
This
address is being used
to feed the National
LMC both address
and data bits for a
certain setting. The
choice which bits are
being read are being
described in the mask
register at $FFFF8924. As
described above, the
first two bits of the
11 bit package need
to be a "10"
to address the LMC1992. Then
there are 3 more "address"
and 6 more data bits. The
address bits are 3 in
total and are being
used as follows:
0
1 1 - Master
Volume (followed by
6 bits of data)
1
0 1 - Left
channel volume (followed
by 6 bits of data)
1
0 0 - Right
channel volume (followed
by 6 bits of data)
0
1 0 - Trebble
control (followed by
6 bits of data)
0
0 1 - Bass
control (followed by
6 bits of data)
0
0 0 - Mixer
(followed by 6 bits
of data).
However,
not all bits of the
6 general data bits
are being used. It is
necessary to have a
multiple of 6 though
since the Microwire
is a 3-bit serial interface.
The explanation of the
6 data bits are (d
means necessary data
bit, x means bit is
ignored)
Master
Volume: d d d d
d d (all 6 bits
used)
0
0 0 0 0 0 =
-80 db volume
0
1 0 1 0 0 =
-40 db volume
1
0 1 x x x =
0 db volume
(max)
Each
increment represents
2 db. If the 3 left
bit encode "101", the
last 3 bits are being
ignored.
Left
channel: x d d
d d d (left
bit ignored)
0
0 0 0 0 =
-40 db volume
0
1 0 1 0 =
-20 db volume
1
0 1 x x =
0 db volume
(max)
Each
increment represents
2 db. If the 3 left
bit carry "101", the
last 2 bits are being
ignored.
Right
channel: x d d d
d d (left bit
ignored)
0
0 0 0 0 =
-40 db volume
0
1 0 1 0 =
-20 db volume
1
0 1 x x =
0 db volume
(max)
Each
increment represents
2 db. If the left 3
bit are "101", the
last 2 bits are being
ignored.
Trebble:
x
x d d d d (left
2 bits are ignored)
0
0 0 0 =
-12 db (min)
0
1 1 0 =
0 db (linear)
1
1 0 0 =
12 db (max)
Each
increment represents
2 db, normalized at
15 KHz.
Bass:
x
x d d d d (left
2 bits are ignored)
0
0 0 0 =
-12 db (min)
0
1 1 0 =
0 db (linear)
1
1 0 0 =
12 db (max)
Each
increment represents
2 db, normalized at
50 Hz.
Mixer
control: x x x x
d d (left 4 bits
are ignored)
0
0 = DMA + (YM2149
- 12 db)
0
1 = DMA + YM2149
1
0 = DMA only
1
1 = reserved
Setting
"00" mixes
the output of the YM2149
and the output of
the DMA-sound, but the
YM2149 sound is being
downsized by 12 db.
"01" mixes
DMA and YM2149 linearly,
"00" means
DMA sound output
only.
Mask
Register
$FFFF8924
x x x x x
x x x x x x x
x x x x
This
contains in a bitfield
which bits of the Address+Data Register
are explicetely used.
Since the Microwire,
as it is being
used in the STE, requires
11 bits of data (in
general, the Microwire
can transport 14 bits),
it is essential to let the
Microwire know WHICH
of the 16 bits of this
register are to
be taken into account.As
being used in the STE,
this register will always
feature 11 "1"s
and 5 "0"s.
Example:
Let's
say we want to feed
the LMC the data "011101000", we
would need to write
a "10 011101000"
to the address+data register.
We can use whatever
bits we like of the
16 bits of this register,
so we use the mask register
to mask out the
unused bits, which might
look like:
$FFFF8924
0 0 0 0 0
1 1 1 1 1 1 1
1 1 1 1
$FFFF8922
0 0 0 0 0
1 0 0 1 1 1 0
1 0 0 0
or
$FFFF8924
0 1 1 0 0
1 1 1 1 1 1 0
1 1 0 1
$FFFF8922
0 1 0 0 0
0 1 1 1 0 1 0
0 0 0 0
both
have the same effect.
Sounds
complicated enough but
can boost the DMA-sound
output of the STE quite
a lot. When programming
it first time however
you might easily see
that it did not work
as planned. Why ?
?
Can't hear any changes
on my Falcon ...
!
Unfortunately, the Falcon
does neither have a
Microwire interface nor
the National Semiconductors
LMC1992. The Falcon
cannot manipulate bass,
treble, main, left and
right volume as easily
as the STE can.
The Falcon will not
report an error either
though. The TT does
have the Microwire interface
as well as the LMC1992.
?
I write both address+data
and the mask register
correctly, still it
doesn't have the expected
effect.
!
You need to write the
mask before you write
address and data. As
soon as address+data
register has been written
to, the Microwire starts
to operate (which means
shifting to the left).
Writing the mask register
after writing the address+data
register is therefore
useless.
?
I write data into the
mask-register, then
address and data but it
still doesn't do what
i wanted to.
!
Always make sure you
have a total of "11"
bits, and always make
sure, the leading bits
on the left side are
a "10". Otherwise,
the Microwire will try
to access other peripherals
that the STE does not
have - which will not
lead to an error, but
result in no changes
at all.
?
I tried to achieve sound
manipulation effects
by writing a lot of
values to the LMC1992
to change DMA sound
output. It does seem
to ignore a lot of my
values.
!
The LMC1992 is connected
to the Microwire and
is being fed data
in a serial way. The
Microwire is more or
less a parallel to
serial converter and
it does that by shifting
the 16 bit value
(along with the mask)
to the left 16 times
and passing each bit
for that the mask-bit
is "1" to
the LMC. That takes
some time and during
its operational state,
the Microwire cannot
be written to.
?
How can i find out wether
the Microwire interface
is done ?
!
Simply check the value
in the address+data
register after you wrote
your value into it.
If the value at $FFFF8922
is identical with the
value you wrote into
it, the Microwire is
done shifting and
can once again be written
to. In all other cases,
the Microwire is still
shifting and cannot
be written to.
?
I successfully wrote
to the LMC1992, but
now YM2149 sound output is
pure torture. What happened
?
!
Well, the LMC1992 is
not a chip that controls
the DMA-sound in its
digital form but manipulates
the analogue sound that
comes out of the
DMA chip. If you now
put the mixer to mix
YM2149 and DMA sound,
the LMC1992 will also
manipulate the YM sound
output. However,
the YM2149 as a soundchip
is not really meant
to have Bass and Trebble
enhanced. This might
result in a very ugly sound.
?
My program works fine
and also exits cleanly,
but then any subsequent
sound output is awful.
How come ?
!
You should save the
contents of the LMC1992
right at the start
of your program and
when exiting, you should
restore the original
value - and the easiest
way is to save both mask
and address+data register.
Restoring can be done
by just writing mask
and address+data registers.
The Microwire does not
need any further software
support once you wrote
the values, so it does
not harm if your
program terminates in
the meantime. Programs
you launch when your
program is terminated
that do use DMA
or YM2149 sound might
be affected by your
LMC1992 settings
otherwise.
?
How come the Falcon
does not have this feature
?
!
When the Falcon was
initially planned (and
named Sparrow), it
had a chip that was
supposed to bear similar
features named
RASCAL. It is probable
that this chip was supposed
to "simulate"
a Microwire + LMC 1992
duo as well as give enhanced
possibilites towards
the 16-bit stereo sound
of the Falcon (Sparrow)
as well as the DSP.
Either Atari did not
finish this chip in
time, it was too expensive
or too complex, we don't
know. It appeared in the
first Sparrow prototypes
as well as the first
few Falcon (exhibitors)
boards. However, it
is so far unknown wether
this chip is compatible
to the Microwire+LMC1992
duo or not and
why it has been canned.
?
Why is the handling
of the LMC1992 so complicated
?Wouldn't there have
been an easier way to
give the STE these features
?
!
Yes, of course, but
the LMC1992 was very
cheap. The LMC1992 was
never meant to serve
in a computer but was
commonly used in
TV sets, Radios etc.
and any other Audio-device
that had the option
to control volumes,
bass and trebble electronically,
and those preferred
a "1-bit serial"
implementation. The
Microwire is just the
connection of the STE's
architecture to
the LMC1992.
<Previous> [1][2][3][4][5][6]
<Next>
|