• Please review our updated Terms and Rules here

Reserve a 64k page in MS-DOS

I'm very happy with the results I got :).

I just allocated 32K inside a physical page and used 8 bit PCM (8192 and 11025 Hz). Sound quality is good enough, and you can fit around 10-15 small samples for whatever you want :).

This is an imf music player (OPL2) + PCM drums (for very very slow PC's). It was recorded from dosbox, because my PC created very noisy recording from a real Sound Blaster.

test1.mp3
test2.mp3
test3.mp3

PCM samples are much cleaner on the real hardware :).

I included a simple sample player and a music+sample player in the little game engine I'm making Little-Game-Engine-for-VGA
 
I got into looking at this problem recently, and ended up writing some code to a GitHub repository at https://github.com/juj/64kalloc

At least for DOS Borland Turbo C/C++ 3.0 case in small test programs, I feel that I was able to reliably solve the issue for allocating memory that is 64KB page aligned, without wasting much excess memory in the process. Hopefully the scheme proves robust in the wild and the code can help someone else out there.
 
Back
Top