1
0
Fork 0
mirror of https://github.com/crazii/SBEMU.git synced 2026-05-14 04:41:51 +00:00
legacy sound blaster emulation for DOS
  • C 98.2%
  • C++ 1.6%
  • Makefile 0.1%
Find a file
Volkert de Buisonjé f0cbde0633
Merge pull request #139 from ElTentakel/patch-1
fix missing linux drivers in makefile.dos
2024-10-20 15:19:51 +02:00
.github/workflows ci: Enforce Conventional Commits in Pull Requests 2024-08-18 15:02:54 +02:00
drivers Add maestro3 pci id and correct ac97 volume initialization 2024-07-13 14:18:38 +02:00
mpxplay/au_cards Make pci id's match linux driver support 2024-07-13 14:44:33 +02:00
output Fix all filenames to be lowercase 2023-09-27 16:37:45 +02:00
sbemu compatibility fix on high DMA. 2024-04-30 17:39:47 +08:00
scripts Merge branch 'main' into generate-changelog-with-each-release 2024-05-02 18:18:49 +08:00
.gitignore chore: Add JetBrains IDE metadata directory to .gitignore 2024-08-18 15:31:22 +02:00
CHANGELOG.txt update README.txt and CHANGELOG.txt 2024-05-02 12:29:31 +08:00
CONTRIBUTING.md docs: Add CONTRIBUTING.md file to project with guidelines for project contributors 2024-08-18 15:30:05 +02:00
COPYING add a license file (GPLv2). 2023-12-20 20:49:39 +08:00
hdpmipt.c fix error for djgpp-dos; update RHIDE project files & fix crash on -O2 (djgpp-dos), experiment -O2 (-O2 not working for djgpp-dos). 2024-02-27 18:18:57 +08:00
hdpmipt.h add new HDPMI API call. 2024-02-08 04:14:46 +08:00
irqguard.c re-enables UMB. 2024-04-25 09:42:39 +08:00
irqguard.h add irq guard to prevent virtual irq to pass down to BIOS. 2024-02-27 21:32:48 +08:00
main.c compatibility fix on high DMA. 2024-04-30 17:39:47 +08:00
makefile Linux sound card drivers 2024-04-07 21:51:39 +09:00
makefile.dos fix missing linux drivers in makefile.dos 2024-09-14 18:15:19 +02:00
qemm.c re-enables UMB. 2024-04-25 09:42:39 +08:00
qemm.h Fix all filenames to be lowercase 2023-09-27 16:37:45 +02:00
README.md docs: Fix spelling in README.md 2024-06-16 22:55:00 +02:00
README.txt docs: Fix spelling errors README.txt 2024-06-16 22:51:34 +02:00
sbemu.gdt update RHIDE project files. 2024-02-27 22:00:56 +08:00
sbemu.gpr update RHIDE project files. 2024-02-27 22:00:56 +08:00
user_instructions.md docs: Combine changelog and user instructions into release notes and show those on each release 2024-01-27 16:17:32 +01:00
utility.c Fix all filenames to be lowercase 2023-09-27 16:37:45 +02:00

SBEMU

Emulate Sound Blaster and OPL3 in pure DOS using modern PCI-based (onboard and add-in card) sound cards.

Supported sound cards

Source code from MPXPlay is used to support the following sound cards/chips.

Enabled and working:

  • sc_ich: Intel ICH / nForce / SIS 7012
  • sc_inthd: Intel High Definition Audio (HDA)
  • sc_via82: VIA VT82C686, VT8233/37
  • sc_sbliv: SB Live! / Audigy
  • sc_sbl24: SB Audigy LS (CA0106)
  • sc_es1371: Ensoniq ES1371/1373
  • sc_cmi: C-Media CMI8338/8738

Support compiled-in, but untested:

  • sc_via82: VIA VT8235

Source code exists, but "doesn't work yet":

  • sc_sbxfi: Creative X-Fi EMU20KX

Additional Linux drivers ported by jiyunomegami

  • SB X-Fi (EMU20K1 & EMU20K2)
  • YAMAHA YMF7x4
  • ALS4000
  • OXYGEN(CMI8788)
  • ESS Allegro-1 (ES1988S/ES1989S)
  • Trident 4D Wave

Emulated modes

  • 8-bit and 16-bit DMA (mono, stereo, high-speed)
  • Sound Blaster 1.0, 2.0, Pro, Pro2, 16
  • OPL3 FM via DOSBox' OPL3 FM implementation
  • OPL3 passthrough to Hardware FM if it's present on the PCI sound card.
  • MPU401 UART emulation, or passthrough to PCI sound card if supported.

Requirements

  • HDPMI32i (HDPMI with IOPL0)
  • Optional, for real-mode game support (I/O trapping):
    • JEMM with QPIEMU.DLL loaded
    • or QEMM, commercial software

For memory management, use either:

  • JEMMEX only: Provides both HIMEM + EMM
  • HIMEMX and JEMM386: Separate HIMEM + EMM

In both cases, use JLOAD (from the Jemm distribution) to load QPIEMU.DLL before starting SBEMU, so that real-mode support is enabled. If you don't load JEMM+QPIEMU (or QEMM), only protected mode applications will be supported.

README for End Users

If your want to use SBEMU without building it, please read README.txt for setup and a list of command line options.

Building from source

macOS, Linux and Windows is supported. For Windows, consider using WSL2 + Linux binaries. If you need to frequently debug/test on your local DOS, there's a makefile.dos for you.

Installing a cross-compiler (DJGPP)

Scripts to build a recent GCC toolchain for DJGPP are available here:

There's also prebuilt releases for the toolchain if you don't want to build DJGPP yourself. The current version (October 2023) is using GCC 12.2.0, but in the future newer GCC versions might become available:

Installing make

This assumes a Debian/Ubuntu installation. If you are using any other distro, I'm assuming you know your way around and can translate those instructions to your specific distribution.

To get make and other tools, it's easiest to install host build tools:

sudo apt install -y build-essential

On MacOS, install the Xcode command-line tools, which should give you make and other host utilities.

If you are planning on building DJGPP from source, some additional build tools are needed. Refer to the build-djgpp README file for details.

Installing DJGPP on DOS

With the source code increasing, it's not recommended to build from DOS. Also the DJGPP DOS build doesn't use -O2 and -flto, because the GCC version is old and buggy with -O2.

If building the project on DOS is needed, download the original DJGPP from here: https://www.delorie.com/djgpp/zip-picker.html It has make utility too.

  • Select MS-DOS,OpenDOS,PC-DOS in the Which operating system will you be using? drop down,
  • Check C++ checkbox on Which programming languages will you be using?
  • Click Tell me which files I need
  • Unpack all the zip files into a same folder, and put it on your DOS partition (i.e. C:\DJGPP)

DOSLFN is also need to perform build. The PATH env needs to be set properly before building. set PATH=%PATH%;C:\DJGPP\BIN is recommended to be put in autoexec.bat, and then

make -f makefile.dos

You can also uses RHIDE to perform editing & building on the fly: add SET DJGPP=C:\DJGPP\DJGPP.ENV to autoexec.bat and then just run rhide in the project root via command line. Use Alt+C to active Compile menu and select Make for dependency build or Build all for a clean build.

Building the project

The bin folder of your DJGPP toolchain needs to be in your $PATH, so that the following command works and outputs your DJGPP GCC version:

i586-pc-msdosdjgpp-gcc --version

If this works, building the project is as simple as:

make

Because you are on a modern machine with multi-core CPUs, do a parallel build, which is faster, for example, for a quad-core CPU, use 8 parallel processes to speed up building:

make -j8

After the build is done, you'll find the build result in a folder called output, i.e. output/sbemu.exe.

Feature usage

CD Audio

CD audio support in DOS requires two parts:

  1. Audio control (play/pause/seek/...) via MSCDEX (or SHSUCDX)
  2. Volume control via the mixer

For part one, you need to have a CD-ROM drive with analog audio out and an MSCDEX-compatible CD-ROM driver set up.

Part two (volume control) is taken care of by SBEMU on startup.

To adjust the volume of CD-Audio (by default it's 100% volume), you can use any Sound Blaster-compatible program, such as "SBMIX", as SBEMU does emulate and forward CD-Audio mixer settings.

Don't forget that to actually hear anything, you need to connect an analog audio cable from your CD-ROM drive to the 4-pin CD-IN header on your soundcard (or motherboard for onboard sound).

Debug output on serial

You can configure SBEMU to output its debug messages to the serial port instead of the console. This also works in the background when games are full-screen, and so is really useful for debugging.

To build SBEMU with debug output, use:

make DEBUG=1

Then, launch SBEMU with this command for debug output (9600, 8N1) on COM1 (use /DBG2 for COM2):

sbemu /DBG1

To disable serial port debug output at runtime, use:

sbemu /DBG0

Serial debug output is disabled by default.