[comp.sys.ibm.pc.hardware] Sound Blaster Registers

fasciano@IRO.UMontreal.CA (Massimo Fasciano) (08/07/90)

Hi everybody,

  The soundblaster manual gives the adresses of all of the
  card's I/O ports but does not explain exactly how to use
  them...

  Suppose I wanted to write a simple program that reads samples
  from the A/D , stores them in memory, and then plays them back
  through the D/A (simple enough!). What would I do exactly?
  The manual mentions a read port for the A/D and a write port
  for the D/A but there is also and INIT port and control port.
  How do I use them?

  As for the ADLIB channels, does the ADLIB manual give more
  exact info than the SB manual? 


			Thanks in advance

			Massimo

(if you feel the info can help others, post it on the net, otherwise
e-mail me at fasciano@iro.umontreal.ca)

--

Massimo Fasciano (fasciano@iro.umontreal.ca)

tjw@unix.cis.pitt.edu (TJ Wood WA3VQJ) (08/14/90)

In article <1990Aug7.153600.10175@IRO.UMontreal.CA> fasciano@degusse.UUCP (Massimo Fasciano) writes:
>Hi everybody,
>
>  The soundblaster manual gives the adresses of all of the
>  card's I/O ports but does not explain exactly how to use
>  them...

I saw the sound blaster hardware in an electronics store (here in Pgh)
for $299 about 2 weeks ago and it looked so neat that I had to buy one.

Now the salesman insisted that it had a text to speech chip on it but
from what I can see it simply has a DA and an AD (along with the
MIDI/JOYSTICK port).  Anyway, I've wanted to fool around with a DA since
my PDP-11 days.

So I get this thing home and start playing with it.  I used the canned
programs and got the thing operational.  (I suppose that the guy who
wrote the programs is the one I'm hearing.  He's obviously not from
Pittsburgh, with that far east accent! ;-)

Anyway, after digitizing some BAGPIPE music from a CD player,  I wanted
to program this board myself.   (At 13,000 Hz the music sounded OK, but
hey, all that squealing isn't probably in the original recording.  But
with bagpipes how can you tell!?! ;-)

So I look at the program loadable driver described in the back of the
manual and I finally conclude that it REALLY is just what they say it is:
program loadable.  It's instructions that have to be copied into memory
(at any segment, starting at displacement zero).  Well, this turned out
to be, for me, easier said than done.  Whenever I link my "driver area"
(created by MS Assembler) in with my MS C main program, it's never at
displacement zero of the segment.  It's always at displacement "A" or
"E".  At zero is some code (I assume from MS C).  I finally took the
hacker's approach and just overwrote the instructions.  I'm playing the
game of "overlaying" the driver with the original code, but I'm doing
it myself.

I got the driver working, but I'm not real happy with the solution.  I'd
much rather have a driver that was relocatable.  (I pulled a
disassembler off the net, but I don't have the time now to do all the
symbol substition).  I'll probably keep working with it in my "spare"
time.

However, if anyone out there in net land would like a copy of the code
I now have, I'll be happy to send it.  Beware: I don't write MS C or
MS Assembly code for a living, just for fun.  All of this is a learning
experience for me!

Also, if anyone else wrote a program for this board, I'd love to see it,
too.  Anyone buy the "Programmer's Toolkit" that they sell for $100?

Terry J. Wood
-- 
INTERNET: tjw@unix.cis.pitt.edu  BITNET: TJW@PITTVMS  CC-NET: 33802::tjw
UUCP: {decwrl!decvax!idis, allegra, bellcore}!pitt!unix.cis.pitt.edu!tjw
 And if dreams could come true, I'd still be there with you,
 On the banks of cold waters at the close of the day. - Craig Johnson 

minakami@Neon.Stanford.EDU (Michael K. Minakami) (08/14/90)

In article <28112@unix.cis.pitt.edu> tjw@unix.cis.pitt.edu (Terry J. Wood) writes:
>
>So I look at the program loadable driver described in the back of the
>manual and I finally conclude that it REALLY is just what they say it is:
>program loadable.  It's instructions that have to be copied into memory
>(at any segment, starting at displacement zero).  Well, this turned out
>to be, for me, easier said than done.  Whenever I link my "driver area"
>(created by MS Assembler) in with my MS C main program, it's never at
>displacement zero of the segment.  It's always at displacement "A" or
>"E".  At zero is some code (I assume from MS C).  I finally took the
>hacker's approach and just overwrote the instructions.  I'm playing the
>game of "overlaying" the driver with the original code, but I'm doing
>it myself.
>

Why not just malloc some memory (large model MSC), find the closest 16-byte
boundary, and load the driver there? A little segment calculations and you
can get a 0-offset address. At least that's what I did...segment arithmatic
isn't the greatest thing in the world in C (lots of casting pointers to
longs and back again), but it seems to work. 

Has anyone gotten a Sound Blaster program to work under Windows? I thought
it'd be kind of neat to play some music while using QVT or something, but
apparently the two don't like each other. Maybe something to do with using
the DMA channel?

m&m

-- 
-----------------------------------------------------------------------
The child can explain the man better than  | Michael K. Minakami     
      the man can explain the child.       | minakami@neon.stanford.edu 

dlou@dino.ucsd.edu (Dennis Lou) (08/14/90)

In article <1990Aug14.042014.12967@Neon.Stanford.EDU> minakami@Neon.Stanford.EDU (Michael K. Minakami) writes:
>Has anyone gotten a Sound Blaster program to work under Windows? I thought
>it'd be kind of neat to play some music while using QVT or something, but
>apparently the two don't like each other. Maybe something to do with using
>the DMA channel?

If it's just music you'd like to play, wouldn't you wnat to use the
CMS chips or the AdLib capabilities instead?  Kind of a waste for a
DAC voice channel to be playing digitized music.

I'd imagine the problem is that the DAC might be using COM 2's
interrupt (which in turn might be connected to a mouse).  In that
case, using the CMS or Ad Lib sections would be the way to go...

Does anyone know how to program the CMS or Ad Lib chips?


--
Dennis Lou                Disclaimer: I don't use lame disks.
dlou@dino.ucsd.edu         "But Yossarian, what if everyone thought that way?"
[backbone]!ucsd!dino!dlou  "Then I'd be crazy to think any other way!"

tjw@unix.cis.pitt.edu (TJ Wood WA3VQJ) (08/15/90)

In article <1990Aug14.042014.12967@Neon.Stanford.EDU> minakami@Neon.Stanford.EDU (Michael K. Minakami) writes:

>Why not just malloc some memory (large model MSC), find the closest 16-byte
>boundary, and load the driver there? A little segment calculations and you
>can get a 0-offset address. At least that's what I did...segment arithmatic
>isn't the greatest thing in the world in C (lots of casting pointers to
>longs and back again), but it seems to work. 

Well, the "problem" is that I'm not *really* a PC C programmer (I just play
one at night).  I thought about using malloc (if it's similar to the
pdp-11 unix version) but this would take some additional digging on my
part.  I'd love to see some code to do this, (Hint, hint! ;-)


>Has anyone gotten a Sound Blaster program to work under Windows? I thought
>it'd be kind of neat to play some music while using QVT or something, but
>apparently the two don't like each other. Maybe something to do with using
>the DMA channel?

That would be my first suspicion, too.

Terry
-- 
INTERNET: tjw@unix.cis.pitt.edu  BITNET: TJW@PITTVMS  CC-NET: 33802::tjw
UUCP: {decwrl!decvax!idis, allegra, bellcore}!pitt!unix.cis.pitt.edu!tjw
 And if dreams could come true, I'd still be there with you,
 On the banks of cold waters at the close of the day. - Craig Johnson 

wales@gidday.enet.dec.com (David Wales) (08/16/90)

In article <1990Aug14.042014.12967@Neon.Stanford.EDU>,
minakami@Neon.Stanford.EDU (Michael K. Minakami) writes...

>Has anyone gotten a Sound Blaster program to work under Windows? I thought
>it'd be kind of neat to play some music while using QVT or something, but
>apparently the two don't like each other. Maybe something to do with using
>the DMA channel?

When I tried to play some .voc files in windows it bombed with an error saying
to increase the DMA buffer size in system.ini.  As yet I haven't tried that so
I don't know if it works or not.

-- 
================================================================================
| David Wales (VK2KWD) Sydney, Australia | Internet: wales@gidday.enet.dec.com |
|                                        | FIDOnet:  3:712/517 (My Other Half) |
|  "Only 37 years 'till retirement!"     | UUCP:   decwrl!gidday.enet!wales    |
|                                        |                                     |
|  Opinions expressed are mine and       | Voice:  (61) 2 457-8734 (H)         |
|  mine only!                            |         (61) 2 561-7334 (W)         |
================================================================================

popeye@kitty.ksu.ksu.edu (Karl Richard Buck) (08/16/90)

wales@gidday.enet.dec.com (David Wales) writes:

>In article <1990Aug14.042014.12967@Neon.Stanford.EDU>,
>minakami@Neon.Stanford.EDU (Michael K. Minakami) writes...

>>Has anyone gotten a Sound Blaster program to work under Windows? I thought
>>it'd be kind of neat to play some music while using QVT or something, but
>>apparently the two don't like each other. Maybe something to do with using
>>the DMA channel?

>When I tried to play some .voc files in windows it bombed with an error saying
>to increase the DMA buffer size in system.ini.  As yet I haven't tried that so
>I don't know if it works or not.

I had the same idea and ran into similar problems. I tried running organ in
the background and it sounded like a sick cow. It gave me the impression that
the S.B. is a real system hog. Sure would be nice if some windows wizard 
could write some code to play things in the background (hint, hint).

I'd be interested to hear any ideas on this subject. 
--
 731 Moro		popeye@matt.ksu.ksu.edu	    "Run away! Run away!"
 Manhattan, KS 66502	popeye@ksuvm.ksu.edu		Monty Python
 (913)537-3666		kxb@phobos.cis.ksu.edu