Programming MS-DOS with Power
DOS Programming, Undocumented DOS, and DOS Secrets
Forever Young Software for Hire
Hardware Manufactures and publishers, please look here
See my blog or
Like me on Facebook
Looking to write an Operating System of your own?
Get your own website for only $1.99 a month
This web site is devoted to DOS programming for those of us who still enjoy programming in DOS. Don't get me wrong, I do program in Windows also. In fact, I use VC++, but when it comes to having fun, I still turn to DOS programming. Here you will find hard to find info on programming DOS. I will update this site as frequently as possible.
The title as well as other items on this page state MS-DOS. I am not trying to promote the use of, or state that MS-DOS is better than other DOS operating systems. This is the DOS that I use, and I want to keep a medium to the content of this page. If you use a different DOS and have questions, feel free to call upon me or any content of this page.
Unless otherwise noted, all references to Windows on this site refers to the Windows 9x family of Windows.
If you would like to see any specific code and/or documentation on this page, just e-mail me. Any and all code or documentation that I put on this site is free. I am a strong believer in freeware. The only thing I ask is that you spread the word to your friends. You can request code and/or documentation for Assembler, Basic, C and Pascal as well as any DOS help. There are no dumb questions, just dumb answers.
If you found this site helpful or received some helpful information from me and would like to re-pay the favor, please have a look at my
Old things I collect page.
If you are interested in creating an Operating System of your own, you might want to have a look at my few pages, notes, and/or utilities.
Before sending me an email, you might like to try my FAQ List or my links page first.
The NewBasic package.
Current version: 00.97.52 (25 Aug 2015)
Includes a free assembler, disassembler, linker, and programming utilities.
In each subject there will be links to pages of info/source/etc. of an item of that subject.
Each item will be like the following:
A demo link to an item in that subject
(dd mmm yyyy)
The image denotes that this link is under construction and might/might not be usable.
The image denotes that this item is new item.
image denotes that this page has downloadable file(s). (All download files have the file size indicated)
The link (
A demo link to an item in that subject
) will always have a date of when created/last modified next to it.
The image denotes that this item has been a new item, but is not as new as other items might be with the above image.
The image denotes that this item has been updated. The date after the link denotes when.
Select one of the following subjects:
Disk/Files - Programming the disk and/or file info.
DOS - DOS programs, DOS prompt, DOS compilers, etc.
Encryption/Compression - Encryption and Compression.
Games - Programming Games.
Hardware/System programming - Memory, BIOS, CMOS, and other Hardware/System items.
Input/Output Devices - Mice, Joystick, Keyboard, Modem, Printer, etc..
Misc - Item that don't fit in any/all the other subjects.
Sound - Sound programming
Video/Graphics - Graphics programming
See bottom of this page for other useful links and info.
List of items/pages that are
or have been :
- Nothing more than updated all the links to use the www.fysnet.net domain. Please let me know if you
find a broken link.
DISK/FILES - Info/source/etc. that has to do with disks and their files.
Enumerate the files that are opened (03 Aug 1999)
- Display the file name of each opened file.
Redirection in your own programs (07 Mar 1999)
- How to redirect the standard output in your own programs.
Information on File Handles (07 Jan 1999)
-This page will include a number of items on File Handles.
-1. What value is specified for
in CONFIG.SYS with out reading CONFIG.SYS - Undocumented
Format a floppy disk (04 Feb 1998)
- A routine in assembler callable from Basic to format a floppy disk in the four (4) different sizes. (assembly and basic source included)
The DOS EXE header (05 Jan 2001)
- The DOS EXE Header. (Assembly source included)
Some information on disks (01 Oct 2000)
- Includes an updated boot sector (assembly source included)
- Includes a text based CheckDisk program and more info on the FAT. (C source included)
- Shows how a disk is made up
- Why the disk space remaining and the actual disk space differs.
Getting the Serial Number (09 Dec 1998)
- Getting/Setting the Serial Number of a disk. (Assembly source included) (Basic source included)
Getting the size of a disk (13 Aug 1997)
- Getting the size of a disk and other info like free space. (Assembly and Basic source included)
Get Filenames in a Directory (10 Dec 1999)
- Get filenames from any directory. (Assembly and Basic source included)
- Returns only DIR's when specified.
- Includes code to get a files date and time.
Get all accessible drives (09 Dec 1998)
- Get all disk drives that are accessible by DOS (Assembly source included)
Wipe a files contents (19 June 2000)
- Wipe a files contents and then delete it. Used for security purposes (Assembly source included)
Getting info of a CD (21 Mar 2000)
- Updated the info on the VTOC
- Retrieving the information of a CD (ID, Name, date, etc.) (Assembly source included)
Long file names in DOS (16 Dec 2000)
- Includes info on calculating the CRC.
- Includes info on NT machines. Source included
- Includes using Long file names in DOS. --- ALL DOS versions with FAT system
- Includes source code to get short filename of a long filename
- Includes source code to view long filename in MS-DOS Mode (without Windows 95)
File Exist (05 Dec 1997)
- A small example to show how to call an assembly routine in Quick Basic. (assembly code included)
- Now includes an example on how to have in-line assembly code in your Basic programs
Check Disk (09 Dec 1998)
- Checks a disk drive for ready returns error in DOS' ERRORLEVEL for use in batch files.
DOS - Info/source/etc. that has to do with DOS, the DOS prompt, DOS programs, compilers, etc..
Int21Chk.zip (25 Jan 2007)
- A TSR to log most INT 21h calls to a log file under DOS.
- Here is the readme.txt with details.
Change the colors in DOS (27 Oct 1998)
- How to change the colors in DOS. i.e.: When you use DIR, DOS prints the listing in RED on GREEN. (Why would you want those colors. Christmas ???)
A DEBUG tutorial (04 Nov 1997)
- A Tutorial on DEBUG. We write a small DIR routine. (Assembler source included).
Bugs in DOS and DOS programs (24 Oct 1998)
- Includes bugs to DOS programs and there fixes if any.
- Includes a link to a large text file of basic bugs and quirks.
Batch File Programming (20 Dec 1998)
- Includes tutorials, utilities, and misc info on batch file programming.
Encryption and Compression - Info/source/etc. that have to do with encryption and/or compression of files.
Simple Encryption using the XOR technique (19 June 2000)
- Simple encryption using the XOR technique.
Compression using the splay-tree technique (09 Dec 1998)
- Compression using the splay-tree technique. (Assembly source included)
Encryption using the RC4 or Ciphersaber technique (11 Feb 1999)
- Encryption using the RC4 technique.
Games - Info/source/etc. that has to do with programming games and the such.
A small game tutorial (13 June 1998)
- This tutorial includes information on graphics, animation, and sound. (assembly and C source included)
- This tutorial will have different steps published on this page about every month.
- - Current step: Step 2
Hardware/System Programming - Info/source/etc. that has to do with programming hardware which includes the BIOS, memory, etc. and System Programing.
A correct reboot
(28 Oct 2000)
- Correctly rebooting a machine. (assembly source included).
- The PnP BIOS Data Area (05 Dec 1998)
- How to get the serial number of your Mother Board, the CPU speed, etc. from the PnP BIOS Data area on most Intel AMI BIOS machines.
Getting the CPU type (09 Mar 2001)
- A small simple routine to check for the CPU and FPU type. (assembly source included).
Create your own interrupt (09 Dec 1998)
- Create your own software interrupt "callable" by other assembler code just like calling int 21h. (assembly source included).
A Demo ISR in C (30 Nov 1997)
- Creating your own Interrupt Handler for the TIMER interrupt. (C source included).
- Includes a keyboard handler to check for more than one key press at a time. (C source included)
Interrupt Vectors (09 Dec 1998)
- Getting the address of an interrupt and viewing its code.
Using your own int24h error handler (18 Jan 2000)
- Using your own int24h error handler in your program. (Assembly source included)
Also how to view the assembler source of DOS's Int24h handler and other interrupts.
Viewing the MCB's and the Master Environment Block (22 Jan 2001)
- Includes code to set an environment variable to todays date.
- Includes information about changing an evironment varaible for good. Undocumented
- Viewing the Memory Control Blocks and getting the address of the master environment block. Undocumented
- Includes code to add to the PATH= variable string in the master environment block.
Retrieving the CMOS memory information (06 Jan 1999)
- The CMOS memory information
- Getting the date of the machine, by-passing DOS.
Terminate and Stay Resident Programming (18 Jan 2000)
- Now a complete demo on Terminate and Stay Resident Programming.
- Also includes a routine to 'turn off' the internal speaker using a TSR.
- Includes a TSR to send DOS's screen mode 03h to the Windows clipboard.
- Includes a sample source to hook int 21h and do some code before and after each time int 21h is called.
Get EMS info (10 Jan 2001)
- Shows how to display the information about your EMS. (Assembly source included)
Set a timer (09 Dec 1998)
- Set a internal timer that sets a flag when time is up, allowing your program to do something else without waiting for the timer.
ROM BIOS (02 Dec 1999)
- The values and the uses of the ROM Bios Data area
- Now expanded to include all of the first meg of memory
ROM Version (30 June 1998)
- Print the systems' ROM BIOS version, date, and machine ID
Inter-Segment calls in assembler (09 Dec 1998)
- Inter-Segment calls in assembly can be very similar to Overlays.
- If your program needs to be small so that you have a lot of free memory, try this.
Input/Output Devices - Info/source/etc. that has to do with programming I/O Devices.
- Here is a little about the parallel port.
- Here is some code about USB in DOS.
Mouse Cursor (09 May 2000)
- Setting the Text mouse cursor to different colors.
- Setting the Graphics mouse cursor
Information on Modems (02 Jan 1998)
- Information on Modems. Includes most Hayes compatible commands as well as caller ID and other 'interesting' features.
- Now includes a small, simple terminal program written in versions of C, Pascal, Basic, and assembler that use some of these features.
Printing to Hewlett-Packard
(19 Oct 1997)
- Printing graphics to a Hewlett-Packard in Basic (Basic source included).
Joystick (08 Oct 1997)
- Programming the joystick.
Printing Colored Text (23 Sept 1997)
- Print colored text on an ink jet printer (Quick Basic example included)
A complete mouse library (28 Jan 1999)
- A complete mouse library for assembly and calling the mouse in Basic and C (source included)
Printing graphics on a dot matrix printer (18 Jan 1998)
- Printing graphics on a dot matrix printer (Epson compatible printers).
- Now includes basic code to print large text.
Alt Key (30 Mar 1997)
- A small example to show how to call an assembly routine in Turbo Pascal. (assembly code included)
Detecting the Game port (09 Dec 1998)
- Checking to see if there is a game-card. (Assembly included)
Using the Keyboard buffer (25 Sept 1998)
- Getting keys from the keyboard buffer without using any interrupts or other DOS services. (C source included)
- Now includes code (basic and assembler) to see if a key is being pressed without the annoying keyboard delay. Great for game programming.
Using the buffered keyboard input of Service 0Ah (04 Oct 1998)
- Getting a string of chars from the keyboard with DOS's editing capabilities. (Assembler source included)
Misc Item Programming - Info/source/etc. that has to do with all/none of the other subjects.
An assembler for the SPEW CPU (12 Nov 1999)
- Includes information about the SPEW language/CPU done as Hugi Compo #09
- Assembly (x86) source included is included for the small assembler (SPU).
Get todays weekday name (16 June 1998)
- Get todays weekday name. i.e.: Sunday, Monday, etc.
Communicated with the Windows Clipboard from DOS (09 Aug 1998)
- Manipulating the Windows Clipboard in DOS. (C and Basic source included).
Multiply extremely large numbers (17 Sept 1997)
- Multiply two extremely large numbers in Quick Basic the 'handwritten way'. (Quick Basic code included)
Getting the program name (09 Dec 1998)
- Retrieve the currently running program's path and name from the Environment - Undocumented
Print Hex (30 Oct 2000)
- Print a number to the screen in hex format (small and tight assembler code)
Getting the Command Line parameters (04 May 1997)
- How to get a programs parameters off of the command line.
Executing a program within another program (09 Dec 1998)
- The assembly code listing to execute a program from within another program.
Check Windows (19 Mar 2002)
- Checks to see if in a Windows-DOS session or running in True DOS. Returns version info in DOS' ERROR LEVEL for use in batch files.
- Uses a bug in Windows to see if running in a DOS box even if the "Prevent MS-DOS programs from detecting Windows" is selected in the .PIF file.
- Unknown results using Windows NT versions.
Sound Programming - Info/source/etc. that has to do with Sound Programming.
Producing sound on the internal Speaker (09 Dec 1998)
- Using the internal speaker to produce sound. (Assembly source included)
- Now includes a TSR in assembler to 'silence' the speaker. (Assembly source included)
Playing WAV files in DOS (06 Jan 2002)
- Play WAV files in DOS (Assembly, Basic, and Pascal source included)
Detecting a Sound Blaster (18 Nov 2000)
- Detecting a Sound Blaster or compatible Sound Card. (Assembly source included)
A CD Player for DOS Current Version: 2.25e (12 June 2002)
- CDPLAYER.EXE now allows Drives C: through Z:
- A command-line CD Player for DOS that has all the standard functions including
Eject and Closeing the tray, and background playing. (Exit to DOS
while letting the CD continue to play) (Assembly source included)
- Includes a FAQ list to help you write your own CD player.
Video/Graphics Programming - Info/source/etc. that has to do with the Video and Graphics Programming.
Checking for a VESA compatible system (16 July 1997)
- Checking for a VESA compatible system. (Assembly source included)
Programming the VGA (28 Nov 1999)
- Programming the VGA with pixel resolutions of up to (320x400 x 256 colors) (Assembly source included)
- Now includes an "optical trick" in screen mode 13h (Assembly source included)
- Now includes sample source code for MODE 12h graphics programming (Assembly source included)
BMP files explained (31 Oct 1999)
- Describes the BMP files' header and how it stores graphics and attributes.
PCX files explained (31 Oct 1999)
- Describes the PCX files' header and how it stores graphics and attributes. Also explains Run-length encoding (RLE), which is used in PCX files.
Font (20 June 2000)
- Includes an example on how to have more than one font at one time in mode 03h text.
- Includes C and Pascal versions
- Changes the font of the text mode 8x14 character set.
** Only works on an EGA or better card **
If you are a DOS programmer and need a little help e-mail me with the question and I will get back with you as soon as possible with,
the answer a little bit of code, or what ever it takes. If I can't help you I will point you to someone or somewhere that can. There is no charge for
the help, you don't even have to give me any credit, I just like to pass on knowledge and hope that I can expand mine by helping others.
A Puzzle Page
18 May 2003
Recommended Reading (no graphics)
Programming help for 'Newbies'
This is a page devoted to the Newbie. It has programming help and info for new programmers just starting or novice programmers that would like to learn more.
Utilities and misc programming files
This is a page where I will put misc files and DOS utilities that I have created.
Tips and Tricks of DOS and DOS Programming
Tips and Tricks for DOS and DOS apps, and Tips and Tricks for DOS programming
Undocumented DOS programming
Undocumented DOS Programming
These are some of my Most Used links
NewBasic is my C compiler and x86 assembler for DOS
Benjamin David Lunt
Copyright © 1984-2016 Forever Young Software
Best viewed at a resolution of 1024x768 x 16 bpp
This Home Page was created on Sunday, March 30, 1997
Most recent revision: Monday, 16 May 2016
13:16 US Arizona Time
All rights reserved
About Me |
Legal Notice |
Old Things I Collect |
Forever Young Software for Hire
Operating System Design Series
The Israelites looked at Goliath and moaned, "He is so big! How can we ever defeat him?"
David looked at Goliath and exclaimed, "He is so big! How could I ever miss?"