Text of this page, read by machine (may contain mistakes)
COLECOVISION SOUND USERS' MANUAL Page
Tirst, consider channel 2. Let's say that the only songs which use channel 2
af@ assigned three contiguous song data areas, Sth through 7th (grouping songs
which use the same channel! isn't necessary as far as the code is concerned, but
it makes it simpler to think about). BND_MANACER, as it makes its way through
the song data areas in order, will process the Sth data area (which “belongs
to wong 6) and set PTR_TO_S_ON_2 to the address of byte © in the Sth data area.
Then, the 6th area will be processed, resulting in resetting PTR_TO_5_ON_2 to
the 6th data area (song number 3). Likewise, the 7th Gata area will be
processed, finally leaving PTR_TO_S_ON_2 pointing to the 7th data area (song
mumber 11). The next time PLAY_SONCS is called, it will send to sound chip
channel! 2 frequency and attenuation data in the data area pointed to by
PTR_TO_S_ON_2, namely. the data for song nomber it
Note that although only song 11 will be heard on channel! 2 this pass through
PLAY_SONCS, the timers and data for songs 6 and 3 were nonetheless modified,
Tegarcless of the existence of the higher pricrity song 11. That is, all songs
"keep going", whether or not their data will be output during PLAY_SONCS.
Songs é and 3 are said to have been “overwritten” by song 11. Should song 11
become inactive (end) before song é6 and/or song 3, then the highect priority of
the remaining active songs (i.e., the last cata area within the block of data
areas to use e given channel) will be heard.
Thus, assigning several data areas to songs which use the same channel allows
the creation of “background” songs which can be momentarily interrupted
(overwritten) by a higher priority seng or sound effect (e.g., an explosion, or
a dDonus song) and continue on after the overwriting song is over.
Now exanine the 10th song data cree. Again, let's say that the only songs that
use channel 3 are shown here and that they all share the 10th date area. In
this case, the programmer may have arranged things such that songs 2, 4, and 7
are never active simultaneously: i.e., there was no reason to essign three
Gifferent data areas for songs which never overlap. If, however, this is not
the case and, say, song 4 may be started before song 7 is finished, the O/S
routines would stop song 7 in favor of song 4. That is, for songs that share
the same data area, the most recent song started is the song heard, and
interrupted songs de not continue: f.e., songs sharing the same cata area
truncate each other, In many cases thie may be both acceptable aad desirable,
as it saves RAM space.
NOTE: The preceeding description states that a channel data area pointer is
updated every time SND_MANAGER processes a song cata area: this is actually not
the case. To save processing time, a routine which updates all the pointers is
called only when, after loading the next note in @ song, SND_MANAGER detects
that the data area's CH& or SONCNO has changed. This happens whenever the next
note: 1) uses a different channel (see “Noise notes: special case Type 2
notes), 2) is a special effect note, or 3) is an end-of-song indicator. It is
only necessary to update the channe!l data area pointers in these cases, and
when a new song is started (in JUKE_BOX). See “Pseudo code versions of ma:n
routines".
® The four basic routines, Briefly
The following four O/S routines are the only ones that need be called to create
songs which use the giv Standard note types Gore complete descriptions of esch
routine can be found in the “OPERATING SYSTEM ROUTINES” section):