flat assembler
Message board for the users of flat assembler.

Index > DOS > How interfacing with PCI-soundcards under bare DOS?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
Question Crying or Very sad

Has anyone an idea how to play sound on a PCI-soundcard under DOS?

Isn't there at least a way talking to a SoundBlaster 16PCI compatible soundcard? (which should be standarized like the original Soundblaster)

Apparently, there is nothing on the whole net at all!!! (even Ralf's list hasn't anything to this subject)

The only thing I know is that there are PCI-BIOS functions and ACPI-BIOS stuff for under DOS, but there is nothing specific for PCI-Soundcards.

Crying or Very sad Crying or Very sad Crying or Very sad

This is one of the subjects which makes me running up the walls since I started programming for DOS ( in other words: for YEARS) Question Question

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 23 Aug 2004, 18:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7755
Location: Kraków, Poland
Tomasz Grysztar
Everything depends on what chipset is on the PCI card you want to access. For accessing PCI you can use BIOS functions, though I prefer to do it directly (ports 0CF8h-0CFCh, they are described in Ralf's ports list).
As for the sound chips specifications you can look for them in the internet, but in most cases it is unlikely you will find any, because this info is generally kept proprietary (I really don't know what is the reasoning for this). Though I was able to find the specification for ES1371 chip (the CT5880, which is compatible with ES1371, was used by "Sound Blaster 4.1" PCI cards) through Google.


Last edited by Tomasz Grysztar on 23 Aug 2004, 18:51; edited 3 times in total
Post 23 Aug 2004, 18:40
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7755
Location: Kraków, Poland
Tomasz Grysztar
Below is the sample of functions you can use to access the PCI devices.

You need to know the "Vendor ID" and "Device ID" of the chip you want to programm - if you've got the specification, it will be stated there. From the the address 10h in PCI configuration space for given device you can read the number of base port where the device-specific registers are mapped. At address 3Ch in PCI configuration the number of IRQ assigned to the device is stored.

Hope this helps.
Code:
find_PCI_device:
; AX = vendor ID
; BX = device ID
; returns: BH = PCI bus, BL = PCI device/function
        shl     ebx,16
        mov     bx,ax
        mov     ebp,ebx
        mov     bh,0                    ; scan bus 0 first
    scan_PCI_bus:
        mov     bl,0                    ; begin from device 0, function 0
    try_PCI_device:
        mov     ax,0
        call    read_PCI_configuration
        cmp     eax,ebp
        je      PCI_device_found
        inc     bl
        jnz     try_PCI_device
        inc     bh
        cmp     bh,16                   ; try 16 buses (change if needed)
        jne     scan_PCI_bus
        stc                             ; device not found
        ret
    PCI_device_found:
        clc
        ret

read_PCI_configuration:
; BH = PCI bus
; BL = PCI device/function
; AL = address of register
; returns: EAX = value of register
        mov     cl,al
        and     cl,11b                  ; store offset within double word
        and     al,not 11b              ; align address to double word
        mov     dx,bx
        shl     edx,8
        mov     dl,al
        mov     eax,80000000h
        or      eax,edx
        mov     dx,0CF8h
        out     dx,eax                  ; map double word at 0CFCh
        mov     dx,0CFCh
        add     dl,cl                   ; calculate address of mapped register
        in      eax,dx
        ret     
Post 23 Aug 2004, 18:47
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
It's always a bit the same. Standards for newer stuff is always "proprietary". Basically, that's OK, but, as you said it, there is no use "Proprietaring" a standard like the soundcard one, it would cause noone any harm, since even the PCI-soundcard-standard is somewhat outdated.

Well, I already tried accessing a Sounblaster 16PCI on an ASUS P2B-board and my onboard 6.1-Soundcard on an NForce2 board via interrupts (don't know exactly if it was 15h or 1Ah) and raw Ports (0C8Xh). I even debugged an originally creative Soundblaster 16PCI-driver for DOS (which actually didn't work too).

All 3 methods reported the same error, something like "PCI-BUS inaccessible", whereas it workes fine under Windows 98(no PCI-problems here).

Additionally, I keep asking myself if there's not a simular way accessing USB-devices under DOS, perhaps via EDD functions on interrupt 13h, but it doesn't seem to work neither on my computer.
Post 23 Aug 2004, 18:56
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
thanks, I think I should give it a try.
Post 23 Aug 2004, 19:00
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
Here is a link to some asm code for the AC97 chip set, which is on a lot of moden soundcard's, it's a wav player with built in driver for the above chip.
You can get it here: http://www.programmersheaven.com/zone10/cat592/23237.htm

\\\\||////
(@@)
ASHLEY4.
Post 23 Aug 2004, 19:27
View user's profile Send private message Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog
A nutty thought is:
Since MS wants to rule the world/$
they have cahoots with vendors and made PLUG 'N PLAY
So, arn't those config files for each and every DEVICE hackable ?
And, why haven't they been??????????
What's the key to PLUG 'N PLAY that us DOS folks haven't got yet ?
Post 05 Sep 2004, 05:38
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7755
Location: Kraków, Poland
Tomasz Grysztar
You still need a drivers, even po so called PnP devices.
Post 05 Sep 2004, 08:13
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
That's rigth. I know how to get addresses/memory mapped registers and timings from the config ports/BIOS, but I have no idea how to use them, what to write when to them.
Post 15 Sep 2004, 15:38
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
MCD , I am working on sound card dev, for my OS and do a lot of my testing on dos.
Most onboard sound and some sound card's use the same codec, and can be made to work from the same basic driver, i have about 12 pc some new and some old, but i can get most working with SB16 compatable or AC97 compatable.
So if you send me your soundcard or onboard sound type, i may be able to help ?.

\\\\||////
(@@)
ASHLEY4.
Post 16 Sep 2004, 09:06
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
Quote:

Here is a link to some asm code for the AC97 chip set, which is on a lot of moden soundcard's, it's a wav player with built in driver for the above chip.
You can get it here: http://www.programmersheaven.com/zone10/cat592/23237.htm


This is a great little tool!

Quote:

So if you send me your soundcard or onboard sound type, i may be able to help ?.


Actually, I'm using the onboard sound chipset of the Shuttle AN35-Ultra which uses the NVidia NForce2 Ultra 400 (very nice board, good compatibility, good price, VERY robust and tremendous performance=>Don't mind me, but besides DOS-programming, I'm also gaming laming Laughing under Windows). I think this sound device is actually AC97 or SB16 PCI compatible.
It currently uses the following PCI-configurations:

I/O addresses:
0D400h (128 or 256byte length)
0D800h (128 or 256byte length)

Memory mapped registers:
0DA000000h (I think it was 4096byte length, Confused not sure)

device class:00000401

PCI stuff:
vendor: 10DE (NVidia Corporation)
device: 006A
revision: A1

specific stuff:
bus: 00
device: 06
func: 00

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 17 Sep 2004, 12:43
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
Give me a day or two and i will make a test program for your sound card.
Your onboard sound, does look like it's based on the ac97 chip, but some cards that are based on the ac97, just do not work as they should my "vt82c686" is like that.

\\\\||////
(@@)
ASHLEY4.
Post 17 Sep 2004, 18:09
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
do you really need to access your video hardware that way?
soundcards usually have a base address, ex.: 0x220
and a DMA like : 5
a sampling rate, bit depth 8/16/24 bits

you have seperate MIDI port, and ADLIB is working on each SB card
Post 16 Nov 2004, 23:20
View user's profile Send private message Visit poster's website Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach


Last edited by bubach on 03 May 2005, 08:18; edited 1 time in total
Post 17 Nov 2004, 08:56
View user's profile Send private message Reply with quote
tmssux



Joined: 19 Nov 2004
Posts: 2
tmssux
ASHLEY4 wrote:
Here is a link to some asm code for the AC97 chip set, which is on a lot of moden soundcard's, it's a wav player with built in driver for the above chip.

\\\\||////
(@@)
ASHLEY4.
I wish the above was true, unfortunately its not.
Quote:
Error: Unable to find intel ICH2 based audio device!
ASHLEY4 was rght, that program is useless. Cool
Post 20 Nov 2004, 14:41
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
Try http://board.flatassembler.net/topic.php?t=2353&start=25 and get ichinit.zip
it does more vendors.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 20 Nov 2004, 17:02
View user's profile Send private message Reply with quote
deltre



Joined: 17 Apr 2005
Posts: 12
Location: Netherlands
deltre
I found this link for PCI devices/vendors which seems to be quite complete (found what i needed):

http://www.pcidatabase.com/
Post 30 Apr 2005, 10:50
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
Maybe this should be in a separate topic, but I haven't found any documents online at all related to programming PCI things in general. Anything I've found assumes previous knowledge in dealing with PCI cards, of which I have none. Does anyone know where to find out about this? I've found plenty about PCI vendor ID's, device ID's, etc., but nothing about programming PCI. Ralf's list is great, but it doesn't give me a whole lot of information about programming- it's only a reference doc, not a tutorial or guide. Does anyone know how it works?
Post 22 May 2005, 21:45
View user's profile Send private message AIM Address Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
THEWizardGenius wrote:
Maybe this should be in a separate topic, but I haven't found any documents online at all related to programming PCI things in general. Anything I've found assumes previous knowledge in dealing with PCI cards, of which I have none. Does anyone know where to find out about this? I've found plenty about PCI vendor ID's, device ID's, etc., but nothing about programming PCI. Ralf's list is great, but it doesn't give me a whole lot of information about programming- it's only a reference doc, not a tutorial or guide. Does anyone know how it works?


You seem to have exactly the same problem than me. Actually, the only source I know for getting infos about each actual PCI device driver programming are the linux drivers sources, but you will have to hand convert them all from C into Fasm Sad
Post 23 May 2005, 11:12
View user's profile Send private message Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
I was working on a sound blaster compatible DOS driver that was going to work on my computer at home but I had trouble accessing my soundcard because it was a Aureal Vortex2 soundcard. But at the computer at work it worked on and I think the computer at work is configured as PCI bus 0, device 31, function 5. If so, then you could use the standard SB ports to program the DSP, Mixer, and Midi. The guide I have is here

http://www.cs.ucla.edu/~kohler/class/04f-aos/ref/hardware/SoundBlaster.pdf
Post 23 May 2005, 14:14
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.