NewBasic Compiler -- An x86 Compiler/Assembler/Disassembler for DOS

The NewBasic Compiler, NBC.EXE (found here), is a small C compiler which produces assembly code
ready to assemble with the NBASM assembler.

This compiler is heavily based on SmallerC.

The story:
I have been writing a small operating system called FYSOS for some time.  As with operating systems, you have the first stage boot code, the loader (aka the second stage boot code), and the kernel.

The first stage boot code is written in assembly and usually assembles to a few 512-byte sectors.  It is fairly difficult to write this stage in any other language other than assembly.  The advantage is that you only have to write a minimum amount of code to load the second stage loader.

My second stage loader started out to be quite small and was written in assembly language.  As my loader and OS advanced in function, the loader started to become quite large.  After all, it now contains code to use at least five different file systems and BZ2 type compression.

After a while, the assembly files for this loader became quite large and difficult to keep track of, let alone modify.

Then Alex started working on the SmallerC compiler mentioned above and I had the thought that I could take his generous offering and modify it for my needs.  After a bit of work, I was able to modify his compiler to output NBASM .asm code, along with a few other changes.

I was then able to start to write my loader code, the second stage boot code, in C.  Once I started, I realized that with a flat address space, I needed some of the memory pointers to use a segment register other than the default of DS.  Therefore, I started to find how to make the compiler produce these segment overrides.

I'll explain and give examples of these additions below, but first a few more notes.  Alex has added much more capabilities to his SmallerC compiler than mine has.  If mine compiles my loader code, then I don't have much more interest in making it better until the need arises.  However, since I now know how to modify the compiler to output these segment overrides, I may take his latest code, which is much more C compliant than mine, and modify it again.

We shall see if the time and interest arises.

Examples of how the compiler is different than others:
  1. Example: The use of the farC, farD, farE, farF, and farG pointers. These allow you to specify a segment override in your assembly code.
  2. Example: Specifing 16-bit real mode, 32-bit real mode, and 32-bit protected mode code.
Please Note: