[Freedos-devel] sample code: VIA AC97 SoundBlaster mode enabler

2004-07-16 Thread Eric Auer

Hi, if you have a motherboard with VIA VT82c686 southbridge and
AC97 and (!) SoundBlaster sound abilities, you might have noticed
that it is NOT enough to enable both AC97 and SB16 in the BIOS
CMOS setup. Programs act as if SB16 exists (unless you forget to
put a SET BLASTER=A220 I5 D1 or similar line into your autoexec),
but you will hear nothing.

Reason: For some stupid reason, the BIOS of your computer is missing
a small amount of code (less than 32 bytes) to unmute the card at
boot time. As a solution, VIA suggests loading a driver called VIAAUDIO.COM
... which is small, but if you do not use Win3.x (real mode not affected)
you do not even need that small program to stay in RAM!

Note that if you want AdLib / OPL3 music, you must load the software
synthesizer (which uses protected mode and is about 40k small) VIAFMTSR.COM
as well. You can get that driver at www.viaarena.com on the page for audio
drivers for Win... - along with megabytes of other Win32-only drivers in the
same file :-(. So I recommend that you hit google and find a place where you
can get the file alone, and/or hit your mail and tell VIA that they should
put a ZIP of the DOS drivers (far below 100k even with documentation) online
on their official page.

http://www.coli.uni-sb.de/~eric/stuff/soft/specials/ViaAC97enableDOS.c
(meant for DJGPP, but not ready to compile: Add dos.h and some macros like
#define outl(port,data) outportl((port),(data))
#define inl(port) inportl(port)
... my excuses for my syntax-laziness / not including the macros, but I do
actually think that nobody will want a bloated C program for this anyway!
The VIA tool is 0.5k and ViaAC97enableDOS.c explains you how you can do a
bare minimum implementation in 10 lines of NASM assembly...)

To do the (non-Win3.x) basic initialization stuff:

mov al,0x39 ; for enter Win 0x19, for leave Win 0x29
out 0x80,al
mov eax,0x80003d48  ; --- adjust to YOUR pcisel here!
mov dx,0xcf8
out dx,eax  
mov dx,0xcfc
in eax,dx   ; in al,dx would be enough
and al,0xfe ; same for leave Win, for enter Win or al,1
out dx,eax  ; out dx,al would be enough
int 0x20; exit to DOS

Just paste the above code in a file soundon.asm, get NASM from the
http://nasm.sourceforge.net/ site (unless it already came with your FreeDOS)
and do nasm -o soundon.com soundon.asm to assemble (compile) the code
into a tiny DOS program which you can run from autoexec.

The 0x80003d48 value means: access PCI, bus 0, device 7, functon 5, register
0x48. The ports 0xcf8 and 0xcf8 are index and data for PCI config access.
pcisel = (dev11) | (bus16) | (func8) | register | 0x8000 in other
words. Bus 0 is usually PCI-and-onboard-stuff, bus 1 is usually AGP. The
devices on each bus can be numbered from 0..31, but you often have less.
The function number will be 0 unless 1 chip/board serves several functions.

Register 8 is device categorization: If that (32 bit) register  16 is
equal to 0x0401 then you have an audio device. That register  0xff00 tells
you which interface (does anybody know which number means AC97?)... Note
that DOS programs usually do *not* support AC97 sound. VIA has some extra
functionality for SoundBlaster compatibility mode on the chip. Still I would
like to know the register contents (0, 4, ... 0xfc) for nForce2 AC97, maybe
we can figure out something for DOS on that chipset. Easiest way is to use
Linux lspci or scanpci tools with the right command line options, if
possible as root.

Eric.



---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721alloc_id=10040op=click
___
Freedos-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] sample code: VIA AC97 SoundBlaster mode enabler

2004-07-16 Thread Michal H. Tyc
Hi Eric.

On Fri, 16 Jul 2004 16:19:26 +0200 (MEST), Eric Auer wrote:

 Hi, if you have a motherboard with VIA VT82c686 southbridge and
 AC97 and (!) SoundBlaster sound abilities, you might have noticed
 that it is NOT enough to enable both AC97 and SB16 in the BIOS
 CMOS setup. Programs act as if SB16 exists (unless you forget to
 put a SET BLASTER=A220 I5 D1 or similar line into your autoexec),
 but you will hear nothing.

 Reason: For some stupid reason, the BIOS of your computer is missing
 a small amount of code (less than 32 bytes) to unmute the card at
 boot time. As a solution, VIA suggests loading a driver called VIAAUDIO.COM
  which is small, but if you do not use Win3.x (real mode not affected)
 you do not even need that small program to stay in RAM!

I don't own such a motherboard, but once had to configure a machine
of this kind for someone else. I installed the mentioned DOS VIA
Audio driver, and DOS programs could find a Sound Blaster card, but
I couldn't hear anything. There was no effect when I tried to change
volume via standard SB mixer ports. Since I had no time to play with
this, and since the machine was configured to work under Win98SE
anyway, I gave up, but I'd still like to know a solution.

Michal



---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721alloc_id=10040op=click
___
Freedos-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-devel