• Please review our updated Terms and Rules here

DIGPAK drivers released under MIT License. Help wanted to port them from TASM.

digger

Experienced Member
Joined
Jul 9, 2008
Messages
395
Location
Amsterdam, the Netherlands
John W. Ratcliff has open-sourced most of the DIGPAK drivers under the MIT License.

These were formerly commercial drivers that ended up being used in quite a few DOS games back in the day, because they offered a practical hardware abstraction API in a time when the market was being flooded with many different sound cards and standards.

The sources can be found here: https://github.com/jratcliff63367/oldsource

I'm looking for people who could (and would like to) help me with "porting" these assembly sources from TASM Ideal mode dialect to something that allows them to be built with an open source assembler, such as WASM, JWASM, FASM or NASM. My ultimate goal is to offer these drivers for inclusion in the FreeDOS distribution, and possibly to use them as a basis for developing DOS drivers for more modern audio devices.

I've been occasionally dabbling with DOS assembly programming in my free time, but I could use some help with this from some more experienced retro coders, and I'm willing to learn.

Any one here interested? Your help would be greatly appreciated. :)
 
Sorry, I do MASM almost exclusively when working with this stuff.

With "doing MASM almost exclusively", do you mean that you have only experience with MASM, or that you simply prefer it over the others? Do you by any chance have experience with porting assembly code from other dialects to MASM?

Even porting the code from TASM Ideal mode to "regular" MASM dialect would be a step towards my stated goal, since there are multiple open source assemblers that can build MASM sources, notably WASM and JWASM.

And to be clear: I'm looking for people who are willing to help me with this. It's not my intention to just throw this on someone else's plate.
 
I prefer MASM over the other dialects and haven't programmed in any of the others in many years. On x86, I started with the Intel ISIS II-hosted cross-assembler, used the DRI a bit, endured MASM/ASM 1.0 and pretty much stayed with Microsoft for 16- and 32-bit code. Still guilty of using MASM 6.13 from time to time.
 
And to be clear: I'm looking for people who are willing to help me with this. It's not my intention to just throw this on someone else's plate.

Well, have you started yet? :D

This could be fun but to be honest I won't have the time. I would port it to NASM though if I were to try it.
 
Well, have you started yet? :D

This could be fun but to be honest I won't have the time. I would port it to NASM though if I were to try it.

I made an attempt, yes. :) A while back, I tried to get the code to assemble using the Open Watcom v2 assembler (WASM). That assembler has a compatibility flag for TASM Ideal mode, but it's far from complete. I made some changes to the code here and there, and solved a few errors, until I ran into the specific issue that WASM doesn't support the `UNION` keyword. That's not even a TASM Ideal thing. Both MASM and TASM support that keyword.

I just realized that I might be able to get away with just replacing each `UNION` declaration with the largest of its possible data types. The smaller ones will then fit in it as well, and it's not like most assemblers do any extensive type checking, right?

I might also try building the sources with JWASM, since that fork of WASM supposedly has more complete MASM compatibility.

I agree with you that NASM dialect would be preferable, but that seems like even more effort than getting the code to assemble with an open source assembler that has some level of MASM compatibility. But maybe it's not so bad? In my efforts to port the VSB (Virtual Sound Blaster) assembly sources to both NASM and WASM, the latter seemed easier. At least I got the code to eventually assemble with the latter, even though the resulting executable was still not functional.
 
One of the reasons that I stuck with MASM is that I spent time writing Windows NT/2K/XP kernel-mode device drivers. Given that the standard DDK for those platforms is all MASM- and MSC-based, using anything else simply wouldn't make sense.
 
John W. Ratcliff has open-sourced most of the DIGPAK drivers under the MIT License.

These were formerly commercial drivers that ended up being used in quite a few DOS games back in the day, because they offered a practical hardware abstraction API in a time when the market was being flooded with many different sound cards and standards.

I've been reading some of the code and to put it mildly, there's certainly room for improvement. I do wonder though, which games used these drivers?
 
I've been reading some of the code and to put it mildly, there's certainly room for improvement. I do wonder though, which games used these drivers?

Quite a few, actually.

Vogons user Bristlehog made a list of games that supported MIDPAK, which is the MIDI/music counterpart to DIGPAK. Games that used MIDPAK for music typically also used DIGPAK for digital audio playback.

Also, the DIGPAK drivers are compatible with the Audio Interface Library v2 (AIL2) drivers from John Miles, and DIGPAK drivers can even be used as drop-in replacements in games that use AIL2 drivers. (By the way, the list of games that support AIL2 drivers is also quite long, perhaps even longer!)

The first time I heard about that possibility, I was skeptical, but I tried this in Dune II and it actually worked. Which is quite cool, since DIGPAK supports some audio devices that AIL2 does not, notably the Covox Speech Thing (LPT DAC).

So if you add up all the games that support either of these driver models, you end up with a very long list.

And once the DIGPAK drivers are liberated, and the code is used as a basis for newer drivers for more modern sound devices, I expect it to be possible to patch most if not all of these games to support these newer devices.

So yeah, your help (and anybody else's help) would be greatly appreciated! :)
 
This could be fun but to be honest I won't have the time.

Completely understandable, and I also have limited time to work on this. Just a few hours in some of my weekends. But there's no deadline. I'm doing this for fun and to learn. ;)

So here's a suggestion: how about I continue my efforts with porting (with my limited skills so far), and whenever I run into a specific issue that I can't solve myself, I post the error and the problematic code snippet in this thread, and then perhaps you and/or others here can help me with each specific specific roadblock as I encounter them?

It would also be more educational for me, I think. :)

Would that work for you? And yeah, I'll target NASM, then.
 
Sure, I'll do my best to help in any way I can. I do have to warn you though, I've never actually ported any MASM/TASM code to NASM so it will be a learning experience for me as well.

I'm surprised so many games used this. As I alluded to in my previous post, the code is not very efficient, in part because it's made to interface with C. It might also be based on C compiler output. So there's plenty of opportunities to reduce the memory footprint. I also found a bug in one of the TranslateSound routines in SHELL.ASM.

Oh well, let's see where this goes. :D
 
Great! Thanks for your help. Yeah, we'll see where this goes. :)

The C interface might be for AIL2 compatibility. The Audio Interface Library v2 was another popular driver model for Real Mode DOS games. John Miles released the AIL2 drivers and SDK as open source years ago. In addition to offering an INT 66h API, the DIGPAK drivers can also be used as drop-in replacements for those AIL2 drivers (recognizable by the file extension .ADV). That is actually useful functionality, since DIGPAK supports some sound devices that the AIL2 drivers did not. This way, games that relied on AIL2 drivers could be patched with DIGPAK drivers, which allowed them to support those additional sound devices.

What kind of bug did you find in the TranslateSound routines?
 
What kind of bug did you find in the TranslateSound routines?

It's the routine at lines 3141 to 3169 in SHELL.ASM. It looks like this;
Code:
IF DIG_ECHOII
Proc TranslateSound near
;; CX ->number of bytes in sound sample.
;; ES:BX -> far address of sound sample to be played.
;; Registers DX,CX,ES,BX,DS must be saved.
push bx
push cx
push dx
push di

mov di,bx ; becomes dest.
cld
@@DOT: mov al,[es:di] ; Get full 8 bit unsigned sample.
add al,128
or al,01
cmp al,80h
jne @@OK  ; <------ BUG (Will always jump)
inc al
@@OK: stosb ; Store result
loop @@DOT ; Complete the translation process.

pop di
pop dx
pop cx
pop bx
ret
endp

ENDIF
I have no idea what it's supposed to do so don't know how to fix it.
 
I've ported the digpak stuff, found on github, to masm 6.1x this week. The ported source code produces 100% identical binaries, except for align padding. Where do you want it posted ?
 
Pretty sure that wasm (Open Watcom Assembler) accepts masm 6.1 syntax.
 
Pretty sure that wasm (Open Watcom Assembler) accepts masm 6.1 syntax.

Yes, but there are differences. For example, IIRC WASM requires that you explicitly declare procedures as public whereas in MASM all procedures are public by default. See also digger's post above about UNION. Anyway, my point is that Wojciech Galazka's claim that binaries are identical is only valid if he is using an open source assembler since that was the requirement from the OP. He didn't mention which assembler he used.
 
Good news. I tried assembling Wojciech Galazka's MASM port using JWasm v2.14 and the assembly succeeded without any errors or even warnings.

Great job, Wojciech! :)

Also, the resulting TSR loaded successfully, at least in DOSBox. Haven't checked whether the driver actually works in a game or anything, but it's late here right now, and I'll happily test that soon.

See this post on GitHub for details.

I hope to combine the efforts of Wojciech Galazka and Trixter so far, and to improve the DIGPAK sources for more fun retro DOS tinkering. Also, I hope to eventually offer these for inclusion in the FreeDOS project, which would finally scratch off a very old item from that project's wishlist.

Any more contributions to this project are absolutely welcome!
 
Last edited:
Hi,

What do you want to do with Digipack ?

Add support for more devices for games supporting it ?
 
What do you want to do with Digipack ?

Add support for more devices for games supporting it ?

Maybe that would be too tedious to do without having the source code of the game... I don't know up to what point it is worth the effort. That for the games that load the driver into memory. Perhaphs for games that relay on a TSR would be easier.

Nevertheless, I think the drivers and SDK, now made public and free, could be used for releasing new DOS games. They really may facilitate all the SFX managing, saving a lot of hours of coding. I'd wish I knew about these before... :p

I also read somewhere (maybe on the project's github) an idea about building drivers for FreeDos. But I don't have any more details about this, and I cannot figure out what would be the use and implementation.

Nevertheless, in my personal case, I would use them just the way the author left them, so I downloaded and saved them before any official alteration is made.
 
Last edited:
Back
Top