Atari ST series Technical Reference Manual page 88

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

all of the low-memory variables are protected from access by
programs running in user mode, switch into supervisor
mode to change this system variable. The XBIOS routine Su-
pexec() (explained more fully in Chapter 3) is used to exe­
cute the clickoff() and clickon() routines in supervisor mode.
Making effective use of the ST sound capabilities often
calls for sounds or music to be playing at the same time that
other input/output events are occurring. For this reason, the
XBIOS provides a routine that can be used to play sounds in
the background, unattended. This function is called Do-
sound(), and its syntax is as follows:
long commandlist;
Dosound(commandlist);
where commandlist is a pointer to a data storage area that
contains a number of queued sound commands. Each com­
mand is either two or four bytes in length. When Dosound()
is called, a flag is set that tells the timer interrupt handler
routine to start executing one sound command each time the
timer interrupt occurs. From then on, the timer interrupt
routine reads the next sound command on the list every 1/50
second and executes that command. This continues until the
command to stop is issued. In this way, music may be made
to play in the background while the rest of the program con­
tinues.
The structure of the commands contained in the com­
mand list is detailed in Table 4-5.
Although there are four separate commands, there are
only three distinct command sequences, since commands 128
and 129 work together. The first command, which starts with
a value ranging from 0 to 15, is very simple. It specifies that
the corresponding sound register be loaded with the byte
value that follows. The last command, which starts with any
number larger than 129, is also simple. It specifies that the
timer interrupt pause in its execution of sound commands for
the number of timer ticks indicated by the following byte.
This allows the user to start a note, let it play for a specified
period of time, and then stop it.
The middle commands are a bit trickier. They allow the
user to change a register from a beginning value to an end­
ing value, using a specified increment value. This lets you
automatically change the frequency or volume of a tone for
80
CHAPTER 4

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents