BBS: Inland Empire Archive
Date: 05-11-92 (20:36)             Number: 157
From: RICH GELDREICH               Refer#: NONE
  To: SCOTT WUNSCH                  Recvd: NO  
Subj: Re:opinions...                 Conf: (2) Quik_Bas
>   Sorry to bother you, but I assume you saying you know how to
> access all of these methods.  Could you perhaps give me an idea of
> how to access SB and Adlibs, and perhaps the Tandy 3-voice stuff.
> I'm just interested in how to use these.

    Well, I'll start with the simplest, the SoundBlaster...

    What method do you want? The single sample or DMA? (DMA, short for
direct memory access, allows you to play a digitized sample as a
concurrent process of sorts...). I only know how to do it a single
sample at a time; because that's all I need.

    Well, here how you do it. Since I don't have a printer, I'm going to
have to switch between DOS and by terminal so forgive me if I mess up...

    First, you must initilize the SB. Follow this procedure:

    1. Out a 01h to port 226h (I'm assuming the SB bas address is 220h)
    2. Wait
    3. Out a 00h to port 226h
    4. Wait
    5. Out a D1h to port 22Ch
    6. (continue on to rest of program)
     Now the SB is ready to receive 8 bit samples.

    The following information does not follow the standard approach that
most .MOD players use, but it is much quicker and it has worked every
time on the machines I've tried.

    1. Get the 8 bit sample that you wish to output ready
    2. Compare this new sample with the last sample outputted. Jump
       to step 6 if it is the same for speed
    3. Out a 10h to port 22Ch.
    4. Input a byte from port 22Ch. If bit 7 is set, then loop back to
       #4. (keep on looping until bit 7 of port 22Ch is not set. Do this
       in assembly:

       mov dx, 022ch
       in al, dx
       or al, al
       js @@10

       5. Output the 8 bit sample to port 022Ch. Store this sample in a
          buffer so that you can use it in a compare(see step 2)

       Well, this should hopefully help you out a little. I got the
above addresses from disassembling other .MOD players and seeing how
they do it... The above procedure is MUCH faster than the ways most
other MOD players output samples to SB(like ModPlay, for instance).

       To output a sample to the Adlib, much more work most be done. It
is something like the way you would output sample to the PC-Speaker...
It's got to be done in assembly. I'll give you an overview; if your
still interested, I'll post some assembly & QB code to play a simple

       You first must have a translation table... I do have the code to
generate these tables, so it's no secret... To output a byte, the
following procedure would be followed(a very general approach follows)

       1. Set BX to the 256 byte translation table
       2. Set AL to the byte to be outputted
       3. XLAT from the table
       4. Output the byte to a frequency divider; this could be the
          PC-Speaker or the Adlib's voices.

       Again, I found this out by disassembling a few sound utilities
and seeing what they did.

        Well, I haven't given you all of what you wanted, but it is
much better than what I had 3 months ago. Ow ya, if you need some Tandy
3 voice drives, I can post them for you.


--- RBBSMAIL 17.2A
 * Origin: Computer Co-Op RBBS HST, 609-784-9404 Voorhees
NJ (RBBS-PC 1:266/29)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET