OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: how to implement a sound blaster 16?
PostPosted: Sat Apr 21, 2018 9:40 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Good day! I would like to implement a Sound Blaster 16 in my operating system but I don't know how do I do it. Page https://wiki.osdev.org/Sound_Blaster_16 me didn't help because I don't know how I have to play the sound. I tried to send to port 0x0C command 0xE1 I found the version Sound Blaster but on port 0x0A no output. Please where do I get information or code how to implement a sound blaster 16?

//edit: I use Qemu.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: how to implement a sound blaster 16?
PostPosted: Wed Apr 25, 2018 4:58 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
Hi,

The Sound Blaster hardware is actually quite out of date, though if you wish to, it is still enjoyable to program them. However, it will be hard pressed to find a physical machine with one still present. In fact, if you do, depending on the model, they are quite the collectors item.

I have a simple detection routine at http://www.fysnet.net/detectsb.htm that shows how to detect it in DOS, and then some simple code to play a .WAV file at http://www.fysnet.net/playwav.htm. Please note that they assume you are in a TRUE DOS environment.

Later hardware now uses more modern ways of playing sound. Quoted from this forums wiki (which is a good place to go for more information): "In 1997 Intel specified a new standard, AC97 (short for Audio Codec 1997), that virtually replaced the Sound Blaster standard by specifying higher quality sampling."

Ben
- http://www.fysnet.net/input_and_output_devices.htm


Top
 Profile  
 
 Post subject: Re: how to implement a sound blaster 16?
PostPosted: Mon May 07, 2018 7:24 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Thank you, I managed to detect the Sound Blaster 16. If someone had a similar problem, here is the code in C:
Code:
#define DSP_RESET 0x226
#define DSP_READ 0x22A
#define DSP_WRITE 0x22C
#define DSP_BUFFER 0x22E
#define DSP_INTERRUPT 0x22F

void reset_DSP(void);
void write_DSP(int value);
int read_DSP(void);
void init_SB16(void);

uint sound_blaster=FALSE;
uint sb16_version_major=FALSE;
uint sb16_version_minor=FALSE;

void reset_DSP(void) {
          outb(DSP_RESET, 1);
          wait(1);
          outb(DSP_RESET, 0);
          wait(1);

          if(inb(DSP_READ)==0xAA) {
                    sound_blaster=TRUE;
          }
}

void write_DSP(int value) {
          uint status=0;
          status=inb(DSP_WRITE);

          outb(DSP_WRITE, value);
}

int read_DSP(void) {
          return inb(DSP_READ);
}

void init_SB16(void) {
          reset_DSP();

          if(sound_blaster==FALSE) {
                    return;
          }

          write_DSP(0xE1);
          sb16_version_major=read_DSP();
          sb16_version_minor=read_DSP();

}

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 55 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group