Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
unterwulf

Homepage

Saint-Petersburg, Russia,
15.11.2024, 11:27
 

SBMIX questions (Developers)

Hi,

Recently I was looking for a DOS utility for changing Sound Blaster (more precisely ViBRA16C-based ASUS I-A16C card) mixer parameters and SBMIX by BTTR software was one of the top results in Google, so I tried it.

It worked, but had no means to change PC Speaker volume which was crucial for me as I planned to use the card with internal speaker as a primary output device (PC Speaker output from motherboard is connected to the card and the card output is connected to the internal speaker of PC case, so no need in external speakers).

Hopefully, SBMIX comes with the source code, so I was thinking maybe I could modify it to support PC Speaker channel as well. I was able to find Sound Blaster Hardware Programming Guide [1] and it turned out that registers that SBMIX fiddles with are of CT1745 mixer chip which, as the document claims, is only used in Sound Blaster 16 cards.

As per [1] Sound Blaster Pro sports CT1345 mixer chip which registers differ from what SBMIX is changing, yet SBMIX claims to target Sound Blaster Pro and compatibles.

I have no Sound Blaster Pro in my possession to check this myself, but according to [1] SBMIX shouldn't work for Sound Blaster Pro. So I wonder if it's just a vague usage of Sound Blaster Pro term in SBMIX documentation or [1] is not a dependable source of information.

Since SBMIX is such a nice tiny program, I thought it would be fun to reimplement it in pure assembly to see how smaller it would be comparing to a Pascal implementation. It turned out to be about 2K bytes (so 4x times smaller than the unpacked version and 2x times smaller than the packed one). I'm planning to publish it somewhere on the internet and want to ask your opinion on how to do it properly.

1. Should I change the name of the utility? From one hand, the command-line interface is completely the same, so it can be used as a drop-in replacement. From the other hand, it can cause confusion. Although, AFAIK it was a common practice in DOS times to reuse the same name (probably due to lack of information).

2. Should I mention BTTR Software in the command help screen? (Like 'Copyright (c) 1997-2020 BTTR Software'). The only source code reused is ASM routines for changing SB registers which are itself seem to be taken from some SB programming guide, but the look and command-line interface are blatantly stolen from you.

3. Should I stick to 'MODIFIED' BSD LICENSE? I'd rather change it to the MIT license, but won't if you object.

Before I reimplemented it in assembly, I made a patch for the Pascal version which adds PC Speaker volume changing feature. If you are interested, I'd be more than happy to share it with you.

Thank you for your software and this forum (I'm a long-time reader).

[1] https://pdos.csail.mit.edu/6.828/2018/readings/hardware/SoundBlaster.pdf

Zyzzle

15.11.2024, 11:58

@ unterwulf
 

SBMIX questions

> Before I reimplemented it in assembly, I made a patch for the Pascal
> version which adds PC Speaker volume changing feature. If you are
> interested, I'd be more than happy to share it with you.
I'm very interested in both your optimized-ASM version and your Pascal patch.

I've been looking for just this utility which allows adjustment of the PC-speaker volume on SB. I missed its absence in SBMIXER for years. Not sure if a PM is required or if you may openly share where you've uploaded your optimized version.

unterwulf

Homepage

Saint-Petersburg, Russia,
15.11.2024, 13:28

@ Zyzzle
 

SBMIX questions

> I'm very interested in both your optimized-ASM version and your Pascal
> patch.

I feel it's better to wait for an answer from the authors before publishing the derived work.

But I don't see how publishing the patch hurts anyone, so here it is:


--- sbmix.pas.orig      2020-01-21 22:13:20.000000000 +0300
+++ sbmix.pas   2024-11-15 14:55:10.294758909 +0300
@@ -45,6 +45,7 @@
   MIX_LINE   = $2E;   { Line input volume port index }
   MIX_CD     = $28;   { CD input volume port index }
   MIX_MIC    = $0A;   { Mic input volume port index }
+  MIX_PCSPKR = $3B;   { PC Speaker volume port index }
   DSP_GETVER = $E1;   { Get DSP Version command }
   DSPTIMEOUT = $4FF;  { Timeout for DSP }

@@ -60,6 +61,7 @@
   cd,         { CD input volume (as above) }
   line,       { Line input volume (as above) }
   mic,        { Mic input volume (mono, range = 0..7) }
+  pcspkr,     { PC Speaker volume (mono, range = 0..3) }
   chg: Byte;  { flag: the mixer needs re-programming }

   flag1, flag2: Integer;  { flags for string to integer conversion }
@@ -222,6 +224,7 @@
   line := getmixreg(MIX_LINE);
   cd   := getmixreg(MIX_CD);
   mic  := getmixreg(MIX_MIC);
+  pcspkr := getmixreg(MIX_PCSPKR);
 end;

 { Set all corresponding mixer registers }
@@ -234,6 +237,7 @@
   setmixreg(MIX_LINE,   line);
   setmixreg(MIX_CD,     cd);
   setmixreg(MIX_MIC,    mic);
+  setmixreg(MIX_PCSPKR, pcspkr);
 end;

 { Display current mixer settings }
@@ -253,17 +257,19 @@
   Writeln(' CD volume (Left, Right)........',
           cd   shr 4: 3, ',', cd   and 15: 3);
   Writeln(' Mic volume.....................', mic  and 7: 3);
+  Writeln(' PC Speaker volume..............', pcspkr shr 6: 3);
 end;

 { Display help message }
 procedure help;
 begin
-  Writeln('SBMIX Version 21-JAN-2020  SBPro mixer control'^M^J +
-          'Copyright (c) 1997-2020 BTTR Software'^M^J +
+  Writeln('SBMIX Version 29-OCT-2024  SBPro mixer control'^M^J +
+          'Copyright (c) 1997-2024 BTTR Software'^M^J +
           '[Under `MODIFIED'' BSD LICENSE]'^M^J +
           ^M^J,
           'Usage: SBMIX [<master>] [/W<wave>] [/F<fm>] [/C<cd>]' +
           ' [/L<line>] [/X<mic>]'^M^J +
+          '             [/S<pcspkr>]'^M^J +
           '       SBMIX [/Help|/?]'^M^J +
           ^M^J +
           '  <master> = <both> | <left>,<right> = master volume,     0..15'^M^J +
@@ -272,6 +278,7 @@
           '  <cd>     = <both> | <left>,<right> = CD input volume,   0..15'^M^J +
           '  <line>   = <both> | <left>,<right> = Line input volume, 0..15'^M^J,
           '  <mic>    = <mono>                  = Mic input volume,  0..7'^M^J +
+          '  <pcspkr> = <mono>                  = PC Speaker volume, 0..3'^M^J +
           ^M^J +
           'Note: `BLASTER'' environment variable must be set correctly!'^M^J +
           ^M^J +
@@ -372,6 +379,16 @@
           else
             errhalt;              { wrong Mic volume }
         end;
+      'S':
+        begin
+          Val(par, vl, flag1);
+          if ((flag1 = 0) and (vl >= 0) and (vl <= 3)) then
+          begin
+            pcspkr := vl shl 6; Inc(chg);  { PC Speaker volume in range, set }
+          end
+          else
+            errhalt;                 { wrong PC Speaker volume }
+        end;
       'H',
       '?': help;
       else

ecm

Homepage E-mail

Düsseldorf, Germany,
15.11.2024, 15:59

@ unterwulf
 

SBMIX questions

> 2. Should I mention BTTR Software in the command help screen? (Like
> 'Copyright (c) 1997-2020 BTTR Software'). The only source code reused is
> ASM routines for changing SB registers which are itself seem to be taken
> from some SB programming guide, but the look and command-line interface are
> blatantly stolen from you.

You certainly can't go wrong with including attribution like that.

> 3. Should I stick to 'MODIFIED' BSD LICENSE? I'd rather change it to the
> MIT license, but won't if you object.

I messaged Robert about this. Hopefully he's fine with this. (I didn't contribute anything to SBMIX so it's not for me to decide.)

---
l

Back to index page
Thread view  Board view
22049 Postings in 2034 Threads, 396 registered users, 73 users online (0 registered, 73 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum