DOS-C FAQ


Where can I get more information about DOS-C's design?

Design information about the kernel is in the book, "The FreeDOS Kernel," available from Elsevier. You may purchase it directly from this page

The book covers the design of the kernel and uses example system calls as a guided tour through the kernel. If you plan to hack the kernel, this book is a must for you.

I thought the book was about DOS-C

It is. DOS-C shares the kernel with FreeDOS, an effort to replace MS-DOS for older PCs. But before I start a flame war, the effort was undertaken because Microsoft no longer supports any processor older than an 80386 starting with Windows95 and FreeDOS picks up where Microsoft left off.

Can I use XYZ C to build DOS-C

Yes, but be careful of it's output. Basically, I use Borland C++ v3.1 because it was the last version to output 8088 compatible object code. However, I use Microsoft C v6.0 whenever I debug using the remote debugger because that's what the remote debugger accepts.

I advise you to use whatever compiler you have available and work with it by examining the output. If it's acceptable, that is it will work with your intended target, take an approach similar to what I did. First compile each file individually. Review the warnings and make certain that they don't flag a potential problem. Next link DOS-C, but omit LIBM.LIB. The link will fail, but you will get a set of error messages that indicate what object modules you'll need

With this information in hand, invoke your library utility and use it to examine the libraries distributed with your compiler. Find the object modules you need, extract them and place them into LIBM.LIB. After you've done this for the first time, I suggest you build a MAKELIBM.BAT file similar to mine. You never know when a change or a new feature will invoke a new compiler library module.

Can I use gnu C to build DOS-C

No. The GNU C compiler currently don't support real mode (16-bit) X86 code generation. In addition, it will not run on a PC using MS-DOS in real mode. This defeats the purpose of FreeDOS, so there are no plans to port the compiler at this time. If you'd like to volunteer to write a new gcc back end, send me email.

I can't compile IPL.SYS under BC++ v5.02

I received the following question that I'd like to share here. Please note that you need to add /Tde to create dos executables.

I can compile everything under BC5.02 except the IPL. I get all the object file and everything, but when I go to link it I get this:

TLINK /v/m/Tde/c/l/P-/LC:\BC5\LIB @MAKE0000.@@@
Turbo Link Version 7.1.32.2. Copyright (c) 1987, 1996 Borland International
Fatal: No program entry point

** error 2 ** deleting ipl.exe

I added the /Tde to generate a dos exe file, but I don't know where the @MAKE0000.@@@ came from, do you have any suggestions? I looked in your book, but it doesn't say much about linking.

The entry point for ipl should be defined in ipl.asm by adding the label of the entry point to the end statement. On versions of DOS-C prior to v0.92.1, it looks like I've forgotten to do that. I guess earlier versions of tlink and link simply ignored the entry point or defaulted to some predefined entry point (0 or 100h). In any event, change the 'end' to 'end entry' and the problem should go away.

The @MAKE0000.@@@ file is generated by make itself as part of the build process. Originally, the files I used to build ipl.sys was small, so my rule for linking was simple. Eventually, the list of files that I needed to pass to link was too large to fit on a single line. This broke make so I needed to pass the file list some other way.

If you look at ipl.mak, you'll see that I choose to use make's &@@ that takes the list of files delimited by '|' and creates a temporary file. The way I've written the rule, make uses this temporary file as a response file for tlink and deletes it when done. This eliminates the need to create a response file, say ipl.lnk, and allows me to manage a single file that I place under source control. So, @MAKE0000.@@@ is the file created by make and carries the list of files to link, the names of the exe and map files and the libraries to link to.

Why didn't you use the "foobar" structure that MS-DOS used?

The answer to this is quite simple: DOS-C was not designed as a copy of MS-DOS. I designed the family of DOS compatible operating systems that DOS-C is a part of by using the published programmer's references and a few reference articles. There were no "Undocumented DOS" books or articles when I started, so I was unaware of the extent of dependence upon DOS internals. I chose my own data structures and designed the operating system around them.

With the later releases of DOS-C, I've begun implementing the important data structures as the need arises, so future releases will allow more programs to run on DOS-C that cannot at this time (typically network redirectors, programs that use the redirector facilities to trick the file system code in MS-DOS and TSRs that attempt to multitask MS-DOS).

A little editorializing: there is constant debate over Microsoft's use of undocumented features in MS-DOS, Windows and now Windows95. In all fairness to Microsoft, I've seen other operating systems that also have undocumented interfaces. My opinion is that programmers should avoid these whenever possible. However, Microsoft did go to extremes to hide key features and I fault them for this. You don't go out of your way to hide these key features unless you are actively trying to lock out competition.

DOS-C is open and will remain open. The source code is available to all under GNU GPL and I will continue to make it available in the future. Please do not make changes and fail to publish the source. This violates the purpose of DOS-C.

DOS-C is not part of the FSF software collection, but I do use their GPL to protect my copyright and your right to redistribution.

Why is floppy disk access is so slow under DOS-C?

It's actually very simple. I originally wrote the code as part of a real-time os. That os had disk drivers that worked with dma and were multitasking. So, I took advantage of it and only did all my reads and writes out of the disk buffers. The next sector was always set for read-ahead so that while I was reading or writing the current sector, the next one was filling the buffer.

For the bios drivers, I need to specifically fetch each sector and wait until it finishes. This is too slow to read the next sequential sector so each sector read waits for another revolution of the disk. Since this is tens of millisconds, it is very slow.

In beta 4, I optimize the code and rewrite the code that does the disk accesses. This code will only read into ther buffers fragments from the first and last sectors of the read and everything else inbetween will go directly to user space. That will speed things up considerably.

Remember, you're using work in progress.

What is DOS/NT?

DOS/NT is the commercial predecessor to DOS-C. I designed DOS/NT for embedded systems and there are now quite a few mission critical systems that use it as the basis of their applications. DOS/NT is portable and there are 68K, real mode 8086 and protected mode 80386 versions.

The DOS/NT kernel is made up of four components: the microkernel, the file manager, task manager and the memory manager. The microkernel supports multi-tasking threads and messaging. The task manager uses an extended PSP and supports threads at the user level. It also has the ability to load ROM code so that the code executes in place. The file manager implements multiple file system types including a memory file system. Finally, the memory manager handles all memory allocation and data transfer to and from user memory.

There were three versions available. The first version is a shareware version that just implemented DOS compatibility. It is this version that DOS-C is derived from. There was a registered version that included some handy utilities but did not implement the full features of DOS/NT. Finally, the developer's version implemented all the features and could be built as either a stand-alone system or as an integrated part of an embedded application.

Unfortunately, I am no longer able to supply or support this code for personal reasons.

Does the "ABC" program work with DOS-C?

Thanks to the FreeDOS testing effort, I have the following list of programs that work with the current version. This list updated periodically, so check back occassionally to look for updates.
Works                           Parially works          Doesn't work
-----                           --------------          ------------
WordPerfect v5.1                command.com 0.70        *Norton utilities(1)
*qbasic                                                 *BC 3.1
doom                                                    *DeSmet C
*galaxy word processor                                  *Windows 3.1(2)
*4dos
*logitech mouse driver
*logitech pt editor
*Turbo debugger (BC3.1)
Turbo C++ 3.0
*bwbasic
micro-emacs
*browse file browser
*overview file manager


Notes:
* - verified
1 - missing direct disk support cause failure
2 - complains that HIMEM.SYS is not loaded (we don't have one).
If you want e-mail sent directly to you whenever there is a new feature or the known application list is updated, send email to patv@monmouth.com with the subject subscribe and I will add you to my mailing list.
(Last updated: 14 September 2009)
.
(c) Copyright 2009
Pasquale J. Villani
All Rights Reserved