Text of this page, read by machine (may contain mistakes)
COLECOVISION SOUND USERS’ MANUAL Page 23
Variables required by the affect which will net be output may be stored
wherever the programmer desires. Free locations within the song's data area
might as well be used for effect variable storage, since the entire ten byte
area is reserved for the song anyway. If no free locations exist within a Gate
area, which would be the case if an effect required both frequency and
attenuation to be swept, the effect can store the remaining needed variables
wherever convenient.
In order to interact properly with the O/S sound routines, each special effect
toutine must conform to 2 certain format. A description of that format, and
how an effect interacts with the 0/5 routines, follows:
WHEN AN EFFECT BEGINS - When loading « new note, if LOAD _NEIT_NOTE sees that
the note to be loaded is a special effect:
1) It stores in byte 0 of the song's data area the effect's CK@ and a SONCNO of
62. SONGNO « 62 is used later by PROCESS _DATA_AREA to detect the fact that an
effect is using the date area.
2) It then takes the eddress of the special effect routine Uets’s call it SFX?
from ROM and puts it inte bytes 162 (NEXT_NOTE_PTR.
3) LOAD_LNEZT_NOTE then calculates the ROM address of the header of the nest
nete in the song, stores that address in HL, pots the song's SONCNO tn A, and
calls SFI + 0. In every special effect routine at SFX «¢ 6, there MUST be the
following code which saves the two passed values (see Figure 9):
SFX: LD (SAVE_s_NNP), HL
LD (SAVE_s_SONCNO).A
RIT
SfI+?: code for sound effect starts here
where SAVE_s_NNP is a two byte location used by all the sound effect notes in
the current song to save the address of the nest note in the song, end
SAVE_2_SONGNO is the address of a byte where the song number is saved. The
programser may put SAVE_s_NNP and SAVE_s_SONCNO wherever desired, including
somewhere within the song data area.
Thus, calling SFX + 0 allows each effect routine to save the next note's
address and the song's SONCNO.
IST PASS THROUCH EFFECT - After calling SFX ¢ 0, LOAD_NEXT_NOTE calls SFX + 7
for the first pass through the body of the routine. At this location, there
should be code which initialises the appropriate bytes within the song data
area, as the next pass through PLAY_SONCS, subject to the data area priority
system, will output this initial data in normal fashion.
As will be seen below, this same locstion (SFX + 7 will be called every 1é.?as
by PROCESS_DATA_AREA to modify the data within the area. Therefore, the code
at SFX + 7 must know which pass is in effect, so that the song data area will
be initialized only on the first pass. A convenient way of doing this is te
test Bit 7 of SAVE_s_SONCNO, the byte which contains the saved song nu=ber.
On the Ist pass through the effect, bit 7? (and bit 6) will be sero, since the
largest possible SONCNO (62) would not set this bit. If bit 7 is sero, then,
code to initialize the data area can be executed and bit 7 reset to prevent re~
initialization. Il.e.,