[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New csa2 FAQs: F002s2SOUND (Part 1 of 2)



Apple II Sound Manual II

Csa2 FAQs-on-Ground file: Fxxxs2Sound.txt

This material compiled by the Ground Apple II site, 1997.
 It may be freely distributed.

Note: This is a pure Text file which has no Font, Color, etc.
formatting. To correctly view tables and diagrams on a super-res
display, use a mono-spaced Font such as CoPilot or PCMononspaced.
____________________________




 001- How does the GS produce so many simultaneous sounds? 
 002- Is there a way to output quadraphonic sound on a IIgs?
 003- Do I get Stereo from my IIgs Sound Output jack?
 004- Why should I add a stereo board to my GS?
 005- How can I build my own GS stereo board?
 006- How can I transfer sound files created on a Mac to my GS?
 007- How do I program a Phasor Sound Card?
 008- What is required to build a Sound Input board for my IIgs?
 009- What's what re. MockingBoard hardware and programming?
 010- How do I get my MockingBoard to work on my GS?
 011- How do I play Ultima IV/V with MockingBoard sound on my GS? 
 012- How can I get more System Sounds for my GS?
 013- What GS programs will let me play MIDI files?
 014- Would FExt.NDA let you play thru Synthinit? 
 015- Can I play .WAV files on my GS?






From: Todd Whitesel

001- If the GS only has eight output chanels, then it would
     seen to me that it could only play eight different sounds
     at a time.  So how can I digitize fifteen different sounds
     and play them all back simultaneously?

To summarize the following lecture:

There are 32 oscillators (16 generators) and 16 channels. Not all are
used for actual sound output.

Oscillators are "smart voices" Generators are oscillator pairs that can
generate extra effects with each other Channels are actual independent
output lines like left and right speaker

That said, let's start at the top.

The DOC is a coprocessor with its own dedicated 64K of RAM. All the
sound samples have to be put in this RAM before they can be played.

The DOC has 32 'oscillators' which are essentially smart DMA channels.
Their basic function is to sweep through areas of the DOC memory reading
samples and playing them. They can do so at variable speeds
(automatically repeating or skipping sample values as necessary), they
can loop on a power of two boundary, they can stop when they read a
zero, they have independent volume settings, and various other things
that aid in reproducing complex instruments without loading down the
main CPU.

But when you come down to it, the DOC is capable of playing 32 sounds
simultaneously and independent of each other, provided that all the
sample data fits in the DOC RAM.

The oscillators are not all perfectly identical in operation. For the
basic sample playing and looping they are, but for some more complex
functions they must be paired. This is where the concept of 'generators'
comes from -- the 16 generators ARE operationally identical and that is
why software prefers the generator concept. Both oscillators and
generators are numbered from 0, so oscillators 0 & 1 are generator 0,
oscillators 2 & 3 are generator 1, and so on.

Generator 15 (oscillators 30 & 31) is reserved for system use (one
oscillator is set to loop slowly at zero volume, to generate tempo; I
forget if the other is used by anything, it's probably used to play mono
samples).

Most software use one generator per voice. Since 15 generators are left
over, spec'ing the GS as having "15 voice sound capability" is a fair
statement.

The actual output that comes out the DOC is a 'time-domain multiplexed'
sound output and five digital bits. What happens is this: the DOC
services each oscillator in turn, and for each oscillator the current
sample value is multiplied by the oscillators' volume setting and a
voltage proportional to the product is output on the sound output. Four
of the digital bits are set to the 'channel number' setting for the
oscillator and the last one simply changes voltage from about 3 volts to
about 0.5 (for you EE folks out there, this is the negative edge of an
output-valid strobe).

External hardware is responsible for splitting off the various channels
(4 bits means that there can be 16 of them) and outputting them
seperately. The motherboard hardware just ignores the channel setting
and mixes all the sound outputs into the speaker/earphone. The sound
connector on the motherboard only has room for 3 of the four bits, so
expansion cards that plug into the sound connector can only get 8
seperate output channels. Most stereo cards (AE's sonic blaster, for
example) only pay attention to the lowest bit, so even numbered channels
are left and odd numbered channels are right (or is it the other way
round? I forget).

No, it isn't simple, but it gives a lot of flexibility -- most of which
is largely untapped.

____________________________



From: Keen Jeffrey Alfred
 
002- Is there a way to output quadrphonic sound on a IIgs?

     We all know that is S in GS stands for sound. Stereo cards abound
but the GS is capable of much more.  The following circuit uses the same
technique as stereo cards to decode stereo but decodes quadrophonic.
Inside the GS by the memory expansion slot exists the sound expansion
connector that most stereo cards use. The pin outs are as follows:

     1  Analog to digital in
     2  Analog ground (case ground)
     3  Waveform out
     4  Channel address zero
     5  Channel address one
     6  Channel address strobe
     7  Channel address two

     The analog in doesn't concern us here. The waveform out is the
important signal. The contains the output of all oscilators one after
the other in quick succession (the DOC only handles one at a time). 
When the DOC is outputing the waveform from an oscilator it puts the
channel address from the DOC register $A0 + osc (most significant four
bits) on the three channel address lines and pulls the channel address
strobe low. (The DOC realy has four lines but only three are connected
in the GS).

     The circuit below uses the first two lines the decode the channels
(creating 4 unique channels) and breaks the signal into four parts
depending on the address using cmos single position single toggle wired
as dual position single toggle switches. Then the chopped output is
smoothed with an active low pass filter with a corner frequency of
17.7KHz.

     Because most programs only use stereo the second channel address in
normally low so this circuit will also decode stereo and this will turn
up at the front two outputs.  I have built this circuit on a bread board
but need to make a PC board to make a better sounding circuit.  Also the
output impedance should be set to 75K ohms but I haven't yet gotten
around to it.

     To make sound in stereo or quad all you have to do is place the
binary address of the channel you wish the sound to have in the control
regsister for the ocsilator (the tools can do this) and there you have
it.


                    C1
               o----||----o                |\ 1/4 IC7
               |    R2    | o-----------o--| >o---o
               o--/\/\/\--o |           |  |/   __|___
               |  _       o-|-----o-----|-------|____|--o
         R1    | | \_ IC1 | |     |   __|___   1/4 IC5  |    *
Pin 3--/\/\/\--o-|-  \_   | |     | o-|____|------------o---[O]--FL
                 |     \__o |     | | 1/4 IC5
               o-|+   _/    |     | |      |\ 1/4 IC7
               | |  _/      | o---|-|---o--| >o---o
               | |_/        | |   | |   |  |/   __|___
              _|_           | |   o-|---|-------|____|--o
              ///           | |   | | __|___   1/4 IC5  |    *
                            | |   | o-|____|------------o---[O]--FR
           IC2              | |   | | 1/4 IC5
         ______             | |   | |      |\ 1/4 IC7
         |    |             | | o-|-|---o--| >o---o
Pin 4----|a  1|-------------o | | | |   |  |/   __|___
Pin 5----|b  2|---------------o | o-|---|-------|____|--o
         |   3|-----------------o | | __|___   1/4 IC6  |    *
         |__ 4|--------------o    | o-|____|------------o---[O]--BL
Pin 6----|EN  |              |    | | 1/4 IC6
         |____|              |    | |      |\ 1/4 IC7
                             o----|-|---o--| >o---o
                                  | |   |  |/   __|___
                                  o-|---|-------|____|--o
                                    | __|___   1/4 IC6  |    *
                                    o-|____|------------o---[O]--BR
                                    | 1/4 IC6
                                    |
                                    |     *Note: [O] = Output Stage
                                   _|_
                                   ///

          Typical Output Stage [O]
 
                    C2
               o----||----o
               |    R3    |
               o--/\/\/\--o
    o----o     |  _       |
    |    v     | | \_ IC3 |
----o--/\/\/\--o-|-  \_   |
         R7      |     \__o---------
               o-|+   _/
               | |  _/
               | |_/
              _|_
              ///
 

R1 - R6        : 1.2k ohm
R7 - R10       : 2k ohm trim
C1 - C5        : 47pf
IC1            : LM318  high speed op-amp
IC2            : 74F139N  dual 2 to 4 decoder
IC3 - IC4      : TL072  dual op-amp jfet input
IC5 - IC6      : 4016  cmos SPST analog switch
IC7            : 4069  cmos hex inverter


----------------------


From: Brian Willoughby

     While there is nothing *wrong* with your circuit, I thought that I
would mention that the functionality of IC2, IC5, 6 & IC7 are combined
in a few standard CMOS chips.  It turns out that your circuit is so
useful in many applications that you can easily find it in one chip,
thus saving wiring and lowering noise.

     Look for a Siliconix DG506 or any make of 4058.  I'm not absolutely
sure about the number 4058, but just check in any CMOS 4000 series list
for an 8-channel to 1 analog multiplexer/demultiplexer (not the digital
type, they won't handle audio/sound signals).

----------------------


From: Seth D. Kadesh

One of the chips Brian refers to is a 4052.  Both the LM318 and the 4052
can be purchased from B.G. Micro (214-271-5546).  Cost for both was
$3.75 USA.

The other parts can be purchased from Radio Shack.

____________________________


From: Rubywand

003- My IIgs has a stereo cable plugged right into the
     Sound Output jack. Isn't that two-channel sound?

     Nope; and, it is not "stereo" either. The jack is a standard stereo
jack; but, the "Left" and "Right" outputs are connected to a single
'composite' source. Possibly, Apple originally intended to supply
two-channel sound; perhaps, the idea was just to simplify connections to
stereo systems. (Stereo devotees get upset when you give them just one
'channel' to plug in.)  Whatever, the fact remains: for multi-channel
output you need to add a "stereo board".

-------------------------


004- Why should I add a stereo board to my GS?

     Some programs offer true stereo-- effects and music are lifted from
stereo sources or 'recorded' using two mikes-- others deliver simulated
stereo. Many products output some effects (like a bow twang) through one
channel and other effects (the THUNK! of an arrow hit) through the
second channel. Stereo, of course, produces spacious, '3-D sound'; but,
even the 'separated channels' approach can spread out the action and add
realism.

--------------------------


005- Can I build my own GS stereo board?

     Yes. Apple includes a rough outline for a stereo board design in
the GS Hardware Reference Manual. The "TDX Stereo Board" is a real-world
realization of the Apple description.

Note: See the FAQs Resource file R004STEREO.GIF for the TDX diagram.


     From input to output, the TDX design is straight-forward and
simple. First, IIgs audio enters the 14052 where the "Left" and "Right"
channels are separated using the C0 input to turn ON the appropriate
section (output X or Y) when its channel is valid. (This happens at
supersonic speeds so that the user doesn't notice that each channel is
ON half of the time.)  Then, each output goes to a pair of op amps where
it's filtered and amplified.

     Design objectives were low noise, low distortion, and low power
consumption. From the start I expected that on-board power amp IC's
would be too puny to drive our speakers to desired volume levels and
maintain low distortion; so, the board includes no power amp IC's and is
not intended to directly drive low impedance loads such as speakers.
Like a tuner, CD deck, or other hi-fi source, it connects to a stereo
amplifier's AUX inputs (or "Tuner", "Tape", etc. inputs) or to the
inputs of speaker units with built-in amplifiers. TDX has plenty juice
to drive any decent stereo system at 'blow out the windows' volume
levels.

     As shown in the diagram, nearly all connections between TDX and the
computer, including ground, are made over the J-25 lines. Power (+5
Volts and -5 Volts) comes from the slot into which the board is plugged.
The outputs go to "RCA-type" hi-fi jacks mounted on the rear of the
board for easy access via standard audio cables. When placing the jacks,
be sure to allow space (between the jacks and rear of the computer) for
the cable plugs or arrange for the jacks to line up with an opening.

     The J-25 connection is via a 7-pin mini-molex ribbon cable. It can
go to J-25 (located near the memory expansion slot); or, if J-25 is
being used by the Hyperstudio A/D input board, it plugs in there. (On
both J-25 and its extension on the A/D board, pin #1 is nearest the
front of the computer, pin #2 is next, etc..)  All of the parts,
including the Apple-compatible circuit board, are commonly available.

     I built the TDX stereo board near the start of the IIgs era just as
games like "Tower of Myraglen" were beginning to appear. It sounded
great then and it sounds great today running "Dungeon Master", "Instant
Music", "Jam Session", and Hyperbole MIDI-synth pieces. If your IIgs is
still in mono mode, why not make '97 the year you 'go stereo'. Add a
commercial unit or build the TDX. Either way, when you spread out the
sound you open up the fun!

____________________________



From: Bryan Ogawa

006- How can I transfer sound files created on a Mac to my GS?

I did the following to get stuff that my next-door neighbor digitized on
his LC using the Control Panel Document Sound for Mac Sys. 7:

1. Digitize

Find the System Folder, and the System document/whatever (it's called a
SUITCASE) and double-click:

find the sound I wanted...

copy to my HFS formatted 800K disk

plop it into my GS


2. Convert

Get AudioZap out and sic it on the files.

Click RESOURCE fork when it asks where to get the sound for.

Save it in any format you want.

Then, you can probably use SynthCreate to make a SYNTHLAB wavebank...

____________________________

 

From: Mitchell Spector

007- I just got a Phasor Sound Card and now I need some info.
     What are the 4 DIP switches used for? What are the 2 POTs
     used for? And, where can I get programming information?

     The Phasor is a great sound card. Offers you 12 sound channels
(using all sorts of wave-form patterns and effects, simular to
FM-synthesis in IBMs), 4 white noise generators (synthesized drums, etc)
and a 1-voice synthesized speech channel, expandable to 2 speech
channels. Has a 4 watt amplifier that can drive stereo speakers (left &
right). It's compatible with most older sound cards, like the
Mockingboard, ALF, SMS and Echo+. Few programs ever supported it, let
alone many programs out there that supported the older cards. It did,
however, come with some decent software that showed off the card's
features and let you experiment with it a bit.

     The four DIP switches control emulation modes and standard Apple ][
internal speaker sound-level (only if you disconnect internal speaker
and have old speaker toggling sent to Phasor). Switches #1 and #2 are
for emulations. Switches #3 and #4 control your old internal speaker
sounds, again, *if* you have speaker disconnected and that pin location
on motherboard connected to Phasor.

     You can set Low, Medium and High volume with three different DIP
positions. This doesn't affect Phasor music/sound however. To do that,
you must turn those two pots you asked about. Each controls either the
left or right stereo channel. Turning them clock-wise increases volume,
and you probably don't want this too high up, or sound gets distorted!
Put both on an equal setting, unless you want one channel louder/softer
than the other.


Phasor DIP switch emulation modes:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Native Phasor mode:   1: closed, 2: closed
Mockingboard  mode:   1: opened, 2: closed
Echo+         mode:   1: opened, 2: opened  (Never got this mode to
work!)

____________________________



From: Adrian Whichello

008- What is required to build a Sound Input board for my IIgs?

I found the following circuit on ground (in

ftp://ground.isca.uiowa.edu/apple2/MiscInfo/Hardware/digitizer.circuit

[quote]

If you don't mind putting together a few parts, you can build your own
adapter, though (explanation follows):

   GS
 Analog
   In ---------------+------------+----+----------||------ >>
                     |            |    |  10-500 microfarad
                    -+-          -+-   +      capacitor        To CD
player,
          5V Zener  /_\   Signal /_\   = 1.5V Battery          
microphone,
           diode     |    Diode   |    -                           etc.
   GS                |            |    |
 Ground -------------+------------+----+------------------ >>
 
[end quote]

but I changed it to this (a better ascii rendition of the circuit is
available!):

   GS
 Analog                                                 100 uF
   In ---------------+------------+----+---------+--------||------ >>
                     |            |              <       +
                    -+-          -+-   +-----+    > 10K         To CD
player,
          5V Zener  /_\   Signal /_\   = 3V  <   <              
microphone,
           diode     |    Diode   |    -      ><-+                 etc.
   GS                |            |    |     < 10K pot
 Ground -------------+------------+----+-----+-------------------- >>
 

The Ensoniq is designed to handle 0 to 2.5V input, but audio sources
usually swing more or less equally +/- about zero. Therefore we need a
level shifter, to put the appropriate DC bias onto the input. The 3V
battery and the 10K pot are for this. To stop the low internal impedence
of the battery effectively shorting the sound source (which happens with
the first circuit), I've included another 10K resistor.

The easy way to set this up is to use a program like AudioZap and with
the CD etc.  end input shorted, set the centreline of the oscilloscope
display to be halfway up the screen, so the input signal will swing
equally either side of this reference voltage. The zener diode is to
clip the top of spikes to limit them to about 5V and the signal diode is
to clip any negative going signal to -0.6V. This is protect the Ensoniq
chip from overload.

The capacitor keeps the DC out of the source.  Pin one on the GS
connector is closest to the *front* of the computer (ie with the
expansion slots at the back.

The Ensoniq has a fairly low input impedence (about 3-5K), but most
portable cassette or CD players should be able to handle this, since
most headphones have a much lower impedence than this (usually around 50
to 100 ohms, even as low as eight for old ones). You can use a tape deck
as an amplifier and "impedence buffer" for a microphone.

If you can get the file
http://cassius.ee.su.oz.au/~adrianw/gsaudioin.bsq
there's proof there that it all works (a raw sound file I made).

____________________________



009- Does anyone know where I can get some details on
     MockingBoard hardware and programming?


MockingBoard Mini-Manual  11/97 version

From: Rubywand

 
Part 1: Kinds of MockingBoards

    The original MockingBoards come in four basic 'flavors':

Sound I--    produces music tones and a variety of sound
   effects (3 voices to 1 Audio Output)

Speech I--  produces speech or limited sound effects
  (1 voice output to 1 Audio Output)

Sound II--   2 x Sound I on a single board (3+3 voices
   to 2 Audio Outputs)

Sound/Speech I-- Sound I + Speech I on a single board
  (3+1 voices to 2 Audio Outputs)

Note ...

Audio Output: This goes to a speaker or hi-fi amplifier
Voice: a musical note, sound effect, speech sound, etc.


    Quite a few of the original MockingBoards were sold. Later MB's use
model names like "MockingBoard A", etc.. The main difference between the
original series and letter-named boards is wider availability of Speech.

    Edhel Iaur and Mike Mahon supplied details on models A-D. Prices are
from a Sweet Micro Systems ad in the December, 1985 issue of  _A+_ 
magazine:

MockingBoard A is a stereo music and sound synthesizer with six voices.
Suggested retail price is $99.00. This model has two sockets for adding
speech synthesis IC's so that a user could add speech to one or both
Audio Outputs. Except for the speech upgrade options, MB-A is very
similar to the earlier Sound II.

"MockingBoard B" is just the name of the Speech Upgrade; it is not a
separate MB board. The kit consists of one speech synthesizer chip.
Earlier MB's used the 16-pin SC-01 speech IC, while later board runs
provided 24-pin sockets for the newer (but somewhat flawed) SSI-263
speech synthesizer chip. Suggested kit retail price is $89.00.

MockingBoard C is simply a MB-A that has been upgraded by plugging in
one speech chip. Suggested retail price is $179.00. (There was an
'undocumented' upgrade, obtainable by plugging in the other speech chip,
which allowed the board to "sing harmony" with itself!)

MockingBoard D is a stereo music, sound and speech synthesizer for the
Apple IIc. It connects to a IIc through a serial port and is, of course,
external (unlike the Slot board models for other Apple II's).  Its
drivers are very different from the slot I/O of the other MockingBoards.
Suggested retail price is $195.00.

Phasor is a MockingBoard-compatible sound card produced by Applied
Engineering. Looking at the software that comes with the Phasor may be
helpful to MB users. Phasors may still be available from ABC Direct at
1-800-800-3680 for something around $100.


    MockingBoards work on Apple II's with at least 48K RAM. MB can go
into any Slot (except for MB-D, which must plug into a IIc). Most
programs expect it to be in Slot 4; however, it is fairly common for a
program which supports MB to ask you to enter the Slot #.

    Most for-MB products will work with Sound I, Sound II, Sound/Speech
I, A, and C. (Some work with D.)  Products that use MB include Ultima
III, IV, V Sky Fox, Wiley Byte', Thunder Bombs, Lancaster, Under Fire,
Music Construction Set, GuitarMaster, and Music Star.

    MB's 0.5 Watt Audio Output(s) can directly drive an 8 Ohm speaker.
You can also run the Output(s) to a hi-fi amplifier.

    Except for speech-only models, MB uses the General Instruments
AY-3-8910 Programmable Sound Generator IC. The PSG has 3 on-chip tone
oscillators (via channels A, B ,C) and a Noise Generator (NG). So, for
example, the Sound II can play up to 6 notes or effects at once. The NG
on each PSG can be mixed with any, all, or none of the three tones.


    Many MB "Speech" version boards use the Votrax SC-01 Speech
Synthesizer IC. The SC-01 uses 64 phoneme sounds to produce speech. MB
software lets you adjust duration of each phoneme in 4 steps, create
"rules" for custom sounds, and speak sentences from text in BASIC
programs. The SSI-263 speech synthesizer appeared on later model MB's.
(At present, more info on the SSI-263 is not included here.)

    All MB versions use the 6522 Versatile Interface IC to handle board
I/O. Except for the Sound I board, early models have circuit board
points to which you can add cables to utilize I/O ports not needed for
Sound or Speech.


Part 2: Sound Programming

    Each Programmable Sound Generator (PSG) has 3 output Channels: A, B,
and C. There are also 3 Tone oscillators, one committed to each Channel,
and one Noise Generator (NG) which can send its output to any
Channel(s). Amplitude (output Level or Volume) and Envelope Control
ON/OFF is set for each Channel.

    The PSG's Enable/Disable register has 8 bits. Three bits let you
decide whether or not to send a Tone oscillator''s output to its
Channel. For example, you can enable Tone outputs for the oscillators
going through Channels A and B while disabling Tone output for the
oscillator connected to Channel C.

    The Enable/Disable register also lets you decide whether or not to
send the Noise Generator's output through a Channel. Three bits let you
decide which Channel(s) the NG's output will go through. For example,
you can enable NG output through Channels A and C but not through B; or,
disable NG output through all three Channels, etc..

    If, for example, Channel A's Tone oscillator output is enabled and
NG output is enabled for Channel A, then, a mixed Tone + NG signal will
go through Channel A. Setting Channel A's Amplitude controls the Level
for the mixed signal.

    Often, a programmer will want to individually control the Levels of
Tone outputs (for music) and Noise outputs (for sound effects). This is
accomplished by using one PSG Channel only for Noise and two Channels
only for Tones. Since the MB Sound II has 2 PSG's, a typical game
application using the board will have 4 music tones and 2 effects
sounds-- each individually controlled for Level.

     More specifically, the user can set Tone Frequency (12 bits, 4
coarse & 8 fine) and Amplitude (4 bits) for each channel individually. A
fifth Amplitude bit lets you decide if a channel's Level will be "fixed"
(use the Level value) or "variable" (i.e. follow the current Envelope
pattern).  You have 4 bits to set Noise Generator Frequency.

 Tone Freq = A2 Clock Freq/ [ (4096 x Coarse) + (16 x Fine) ]
 Noise Freq = A2 Clock Freq/ (16 x NG value)

    The Envelope of the combined outputs of enabled sources can be
controlled for Period (16 bits, 8 coarse & 8 fine)**  and, roughly, for
Shape (4 bits).

 Env Freq = A2 Clock Freq/ [ (65536 x Coarse) + (256 x Fine) ]


    The registers of the PSG are described briefly below:

Reg.   Function and Bit(s) used

00     A Freq. fine (bits 0-7)
01     A Freq. coarse (bits 0-3)
02     B Freq. fine (bits 0-7)
03     B Freq. coarse (bits 0-3)
04     C Freq. fine (bits 0-7)
05     C Freq. coarse (bits 0-3)
06     NG Freq. (bits 0-4)
07     Enable/Disable  note: Enable =0/ Disable =1

       bit 5: NG sent to A
       bit 4: NG sent to B
       bit 3: NG sent to C
       bit 2: A Tone
       bit 1: B Tone
       bit 0: C Tone

     Ex: Writing $F0 to Reg 07 plays tones A, B, C plus noise on C
     Ex: Writing $F8 to Reg 07 plays tones A, B, C and no noise

08     A Level (bits 0-3) and
       Envelope Control (bit 4):  1 = Use Env;  0 = Use Level value

09     B Level (0-3) and
       Envelope Control (bit 4):  1 = Use Env;  0 = Use Level value

0A     C Level (0-3) and
       Envelope Control (bit 4):  1 = Use Env;  0 = Use Level value

0B     Envelope Period Fine (bits 0-7)
0C     Envelope Period Coarse (bits 0-7)
0D     Envelope Shape (four bits):

       Continue (bit 3)   0= do 1 cycle and set Level to zero
       Attack (bit 2)     1= count up  0= count down
       Alternate (bit 1)  1= reverse count direction each cycle
       Hold (bit 0)       1= do 1 cycle and hold count


   To program the MB you write to the board's 6522 I/O chip(s). All
address references here are for a MB Sound II (2 Audio Outputs) in Slot
4.

$C400  ORB1  function to perform, Output 1
$C480  ORB2  function to perform, Output 2
$C401  ORA1  data, Output 1
$C481  ORA2  data, Output 2
$C402  DDRB1 data direction, Output 1
$C482  DDRB2 data direction, Output 2
$C403  DDRA1 data direction, Output 1
$C483  DDRA2 data direction, Output 2

Before sending music, etc. data to the MB you must Initialize the
board's I/O. To Initialize the 6522's: Store $FF at $C402 and the other
three DDRxx addresses. This needs to be done by your program just once.

Your program gets access to a PSG via the 6522 by using a few basic
Function codes which set the PSG's I/O control lines:
 
  Set Inactive = $04
  Set PSG Reg# = $07
  Write Data =   $06
  Reset =        $00


To Write to a PSG register: Tell the PSG which Register you wish to
access (i.e. Set the "current register" #) and Write the data. This is
easiest to do with subroutines to handle the basic Functions.

 
Example Subroutines (for Output Channel 1):

Set Reg #     1000:  A9 07   8D 00 C4   A9 04   8D 00 C4   60

Write Data    100B:  A9 06   8D 00 C4   A9 04   8D 00 C4   60

Notice that each Function sub ends by setting the PSG control lines to
Inactive.


Similarly, to do a Reset (set all PSG regs to zero) ...

Reset           1016:  A9 00   8D 00 C4   A9 04   8D 00 C4   60


To put the value $55 in PSG Register 02 (Channel B Freq. fine) ....

1080: A9 02       put Reg#  in A (6502 accumulator register)
1082: 8D 01 C4    store A at the Data address ORA1
1085: 20 00 10    JSR to Set Reg#  (sets "current register" to Reg 2)
1088: A9 55       put the value $55 in A
108A: 8D 01 C4    store A at the Data address ORA1
108D: 20 0B 10    JSR to Write Data  ($55 goes into PSG Register 2)
1090: 60          Exit from subroutine