Introduction

I work for a company who almost exclusively uses IBM Thinkpads and I have been fortunate enough to use several models. They are excellent machine, except for one thing, Mwave!

In short Mwave only really works in DOS, OS/2, and various flavours of Windows because these OS's have drivers supplied by IBM.

What Will This Hack Get Working?

The following hack should help you setup and configure your Mwave sound adapter in Sound Blaster Pro 3.1 (8-bit) emulation mode, with OPL2 support and MIDI interface (where available) on one of the following IBM Thinkpads :

I have also had feedback from several Aptiva owners who have used this hack as a basis to successfully get their Mwave sound adapters working under Linux too.

What Won't This Hack Get Working?

Unfortunately this hack is for sound functionality only and will not get the Mwave modem working. I have used a PCMCIA modem in my Thinkpads to work around this problem. I have tried enabling the Mwave modem using a similar approach to the sound hack but to no avail :-( Any Mwave modem, from any Thinkpad model is affected by this problem.

The Ingredients

Before you can get the hack working, you will need all of the following.

The Method

There are several steps in getting the hack to work, each is listed below.

Install DOS

Currently you will need DOS installed on your hard disk to get this hack to work, with some modifications OpenDOS may work too. Installing DOS is simple enough. For best results try to install on the C: drive, as all my example files will refer to this as the boot device. If you are only installing DOS to get the sound working under Linux then a 30 megabyte partition should be plenty.

Install Mwave for DOS 2.02

Mwave for DOS 2.02 is available below.

Mwave for DOS 2.02 Disk 1
Mwave for DOS 2.02 Disk 2

These files are DOS executables, and when run will auto extract on to 1.44mb floppy disks. Once extracted run install.exe on disk 1.

I know that Mwave for DOS 2.02 isn't the most recent release of Mwave drivers. However, it is the only way to install the Mwave drivers on a DOS partition without having to install either Windows 3.x/Win9x before hand. Using the 2.02 release will keep the amount of space you have to turn over to DOS to a minimum, and there is also no loss of functionality with the 2.02 release over more recent releases. For implementing this hack I recommend you use the 2.02 release.

CONFIG.SYS

Edit your config.sys and make sure it looks something like this.

DEVICE=C:\DOS\HIMEM.SYS /TESTMEM:OFF
DOS=HIGH
FILES=40
BUFFERS=20
FCBS=1,0
STACKS=0,0
LASTDRIVE=Z
COUNTRY=044,,C:\DOS\COUNTRY.SYS
DEVICE=C:\DOS\SETVER.EXE
DEVICE=C:\MWD\MANAGER\MWDP0400.EXE

AUTOEXEC.BAT

Edit your autoexec.bat and make sure it looks something like this.

@ECHO OFF
SET MWPATH=C:\MWD\MANAGER;C:\MWD\MWGAMES;
REM The following is used by DOS games to recognize Sound Blaster hardware.
REM If hardware settings are changed, please change this line as well.
REM See the Mwave README file for instructions.
SET BLASTER=A220 I5 D1
SET MWROOT=C:\MWD
SET LIBPATH=C:\MWW\MANAGER
SET PATH=C:\DOS;C:\THINKPAD;C:\MWD\MANAGER;C:\LINUX;
SET PS2MSG=C:\THINKPAD\PS2.MSG
SET TEMP=C:\TEMP
PROMPT $p$g
REM The CALL MWAVE START statement needs to be the last line in the autoexec.bat
CALL MWAVE START NOSHOW

Mwave Configuration

You will need to edit your MWCONFIG.REF file, this is found in C:\MWAVE_C. Make sure it looks like this.

[NativeDOS]
Default=SBPRO
SBInputSource=Off
SYNTH=OPL3
QSound=ON
Reverb=OFF
Chorus=OFF
ReverbDepth=5
ChorusDepth=5
SBInputVolume=10
SBMainVolume=10
SBWaveVolume=10
SBSynthVolume=10
WaveTableVolume=10
AudioPowerDriver=ON

[FastCFG]
Show=Yes
HideOption=Off

The reason we edit the MWCONFIG.REF is because each time the Mwave Sound card is initialized MWCONFIG.REF overwrites MWCONFIG.INI, therefore any changes that are made to MWCONFIG.INI are lost every time the sound card is initialized. There is away around this but I won't go into it now. When you have finished editing run the following command...
copy c:\mwave_c\mwconfig.ref c:\mwave_c\mwconfig.ini

New mwave.bat

Replace C:\MWD\MANAGER\MWAVE.BAT with the following...

@echo off
rem Check operating system.  Don't run under Windows or OS/2.
checkos
if errorlevel 1 goto end
mwmidi on
if "%1"=="start" GOTO start
if "%1"=="START" GOTO start
if "%1"=="on" GOTO on
if "%1"=="ON" GOTO on
if "%1"=="off" GOTO off
if "%1"=="OFF" GOTO off
if "%1"=="reconfig" GOTO reconfig
goto end
:start
  copy c:\mwave_c\mwconfig.ref c:\mwave_c\mwconfig.ini > NUL
:on
  dosxmgr win
  loadhigh mwdrestr
rem  set show=
rem  if "%2"=="NOSHOW" set show=/n
rem  if "%2"=="noshow" set show=/n
rem  if "%2"=="Noshow" set show=/n
rem  if "%2"=="FASTCFG" set show=/s
rem  if "%2"=="Fastcfg" set show=/s
rem  if "%2"=="fastcfg" set show=/s
rem  mwcfg 5 /s
rem  set show=
  if errorlevel 3 goto Modem288
  if errorlevel 2 goto Telegame
  if errorlevel 1 goto GamesMIDI
  goto Games
:off
  dmfree
  loadhigh dosxmgr mwmdos  %1
  loadhigh dosxmgr mwaudio %1
  mwdrestr /r
  mwmidi off
  goto end
:reconfig
  dmfree
  loadhigh mwdrestr
  loadhigh dosxmgr mwaudio OFF
  loadhigh dosxmgr mwmdos  %1
  loadhigh dosxmgr mwaudio ON
  dosmidi 1
  echo off
  goto end
                   
:Modem288
  loadhigh dosxmgr mwmdos  ON
  goto end
:Telegame
  loadhigh dosxmgr mwmdos  ON
:Games
  loadhigh dosxmgr mwaudio ON
  goto end
:GamesMIDI
  loadhigh dosxmgr mwaudio ON
  dosmidi 1
  goto end

:end        

This slightly amended version speeds up the loading of the Mwave drivers and enables verbose mode.

Install LOADLIN 1.6a

We need to install LOADLIN 1.6a, as this is what we will use to boot Linux from DOS after the Mwave sound card has been initialized into Sound Blaster Pro 3.1 mode. Download LOADLIN 1.6a from Hans Lermen's W3 Home Page. Make sure you get v1.6a this supports the 2.1.x, 2.2.x kernels as it is also backward compatible with 2.0.x releases as well.

Linux Install

You guessed, if you haven't already done so, install Linux now.

Kernel Configuration

You will need to configure your kernel to support Sound Blaster audio. Two examples are given here, one for the 2.0.x kernels and one for 2.2.x

2.0.x Kernel Example


<*> Sound card support
[*] Sound Blaster (SB, SBPro, SB16, clones) support
[*] /dev/dsp and /dev/audio support                                    
[*] MIDI interface support                                           
[*] FM synthesizer (YM3812/OPL-3) support                      
(220) I/O base for SB Check from manual of the card               
(5) Sound Blaster IRQ Check from manual of the card               
(1) Sound Blaster DMA 0, 1 or 3                                   
(5) Sound Blaster 16 bit DMA (_REQUIRED_for SB16, Jazz16, SMW) 5, 6   
(330) MPU401 I/O base of SB16, Jazz16 and ES1688 Check from manual  
(-1) SB MPU401 IRQ (Jazz16, SM Wave and ES1688) Use -1 with SB16   
(65536) Audio DMA buffer size 4096, 16384, 32768 or 65536

2.2.x Kernel Example


<*> Sound card support                                              
<*> OSS sound modules                                               
<*> 100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support
(220) I/O base for SB Check from manual of the card
(5) Sound Blaster IRQ Check from manual of the card                 
(1) Sound Blaster DMA 0, 1 or 3                                      
(5) Sound Blaster 16 bit DMA (SB16, Jazz16, SMW) 5, 6 or 7 (use 1 for
(330) MPU401 I/O base of SB16, Jazz16 and ES1688 Check from manual of
(-1) SB MPU401 IRQ (Jazz16, SM Wave and ES1688) Check from manual of 
<*> Generic OPL2/OPL3 FM synthesizer support
<*> FM synthesizer (YM3812/OPL-3) support 
(65536) Audio DMA buffer size 4096, 16384, 32768 or 65536

Anything not listed above in the sound section of the kernel configuration should either be turned off or left as its default value. Compile and install your new kernel.

Configure LILO

The DOS partition will need to be added to your LILO setup. As root run liloconfig, usually found in /sbin. All the help you need for setting up LILO is covered within liloconfig. Here is my /etc/lilo.conf as an example.

# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
boot = /dev/hda
#compact        # faster, but won't work on all systems.
delay = 50
vga = normal    # force sane state
ramdisk = 0     # paranoia setting
# End LILO global section
# Linux bootable partition config begins
image = /vmlinuz
  root = /dev/hda3
  label = Linux
  read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
# DOS bootable partition config begins
other = /dev/hda1
  label = Dos
  table = /dev/hda
# DOS bootable partition config ends

Only use this as an example. DO NOT copy it into your /etc/lilo.conf, bad things will happen.

Configure LOADLIN 1.6a

You will need to copy your newly compiled kernel to your DOS partition. There are many ways of doing this, its up to you to chose one. An example of how to boot your Linux kernel from DOS follows...

loadlin vmlinuz root=/dev/hda3 rw

Make sure you replace /dev/hda3 with the correct device name for your root ( i.e / )Linux partition

Is It Working?

Now everything is setup you will want to know if it is working. Reboot your system and boot to DOS, the run LOADLIN to start Linux. The are three things things you can do to see if the Sound Blaster emulation is working.

1. dmesg

While the kernel is booting you should see the sound card being initialized. If you missed it, don't worry, just type dmesg and look for one of the following snippets...

dmesg 2.0.x Output


Sound initialization started
Sound Blaster Pro (3.1) at 0x220 irq 5 dma 1,5
Yamaha OPL2 FM at 0x388
Sound initialization complete

dmesg 2.2.x Output


Sound initialization started
Sound Blaster Pro (8 BIT ONLY) (3.1) at 0x220 irq 5 dma 1,5
SB DSP version is just 3.1 which means that your card is
several years old (8 bit only device) or alternatively the sound driver
is incorrectly configured.
Yamaha OPL2 at 0x388
Sound initialization complete

2. cat /dev/sndstat

It is possible to query the sound card using the following command...

cat /dev/sndstat

Again two examples are given here, one for 2.0.x and one for 2.2.x

/dev/sndstat 2.0.x Example


Sound Driver:3.5.4-960630 (Mon Jan 11 12:28:10 GMT 1999 root,
Linux redfox 2.0.36 #1 Sat Jan 9 18:45:06 GMT 1999 i586 unknown)
Kernel: Linux redfox 2.0.36 #1 Mon Jan 11 12:31:59 GMT 1999 i586
Config options: 0

Installed drivers: 
Type 1: OPL-2/OPL-3 FM
Type 2: Sound Blaster
Type 7: SB MPU-401

Card config: 
Sound Blaster at 0x220 irq 5 drq 1,5
(SB MPU-401 irq 1 drq 0)
OPL-2/OPL-3 FM at 0x388 drq 0

Audio devices:
0: Sound Blaster Pro (3.1)

Synth devices:
0: OPL2

Midi devices:
0: Sound Blaster

Timers:
0: System clock

Mixers:

/dev/sndstat 2.2.x Example


OSS/Free:3.8s2++-971130
Load type: Driver compiled into kernel
Kernel: Linux redfox 2.2.0-pre6 #1 Wed Jan 13 16:29:56 GMT 1999 i586
Config options: 0

Installed drivers: 
Type 1: OPL-2/OPL-3 FM
Type 26: MPU-401 (UART)
Type 2: Sound Blaster
Type 29: Sound Blaster PnP
Type 7: SB MPU-401

Card config: 
Sound Blaster at 0x220 irq 5 drq 1,5
(SB MPU-401 at 0x330 irq 1 drq 0)
OPL-2/OPL-3 FM at 0x388 drq 0

Audio devices:
0: Sound Blaster Pro (8 BIT ONLY) (3.1)

Synth devices:
0: Yamaha OPL2

Midi devices:
0: Sound Blaster

Timers:
0: System clock

Mixers:
0: Sound Blaster

3. Playing a sound

Finally you can cat a .au file down the /dev/audio device. Download this, english.au and then try this...

cat english.au > /dev/audio

If the above worked then you're in business. If it didn't work, go back to the beginning of this document and check everything. Trust me, it does work if you do it right.