Atari ST series Technical Reference Manual page 82

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

of memory and start the second screen on the even page
boundary above the stack. As an alternative, we could have
used the Declare Storage (.ds) directive to allocate 32K of
storage at the end of the program for the second screen, but
that would have increased the size of our program to over
32K. Using the method shown above, the entire program
takes just over 300 bytes. Of course, for more complex pro­
grams, you will probably want to use more sophisticated
memory management techniques that require you to shrink
the size of the TP A with Mshrink(). This topic will be dis­
cussed in more detail in Chapter 5 when the Mshrink() func­
tion is explained.
Sound Functions
The ST series of computers use a Yamaha YM-2149, a version
of the General Instruments AY-3-8190 Programmable Sound
Generator (PSG) chip for music and sound effects. This chip
has three sound channels, that can produce continuous
tones, various envelope waveforms, or noise. It also has two
8-bit I/O ports, which are used on the ST for output func­
tions related to the floppy disks, RS-232 serial port, and Cen­
tronics parallel printer port.
The PSG chip has 16 internal registers, but it communi­
cates to the processor through two external ports. The first
port (which in the current STs is addressed at $FFFF8800) is
used for selecting the internal register to read or write. To
select a register, write a register number (0-15) to this port.
After you have selected a register, read it through the first
port, or change it by writing a the new value to the second
port (which in the current STs is addressed at $FFFF8802).
This procedure is complex, so the XBIOS provides a function
that allows you to read or change any PSG register in a sin­
gle step. This function is called Giaccess(), and its called like
this:
char regvalue, value;
int regnum;
regvalue = Giaccess(value, regnum);
where value is the new 8-bit number to go into the register
and regnum specifies the register number to use. If you are
using this function to read the register, the register number
(0-15) is used in regnum. If you're using the function to write
a new value to the register, add 128 ($80) to the register
74
CHAPTER 4

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents