12

I am working on porting uc/OS-II from DOS to x86 (real mode). I need:

  1. A compiler to generate real mode 16-bit x86 assembly

  2. An assembler to assemble the generated assembly into an object file

  3. A linker to link the object files together and output an executable (raw binary, COFF, PE, or ELF formats are fine)

  4. A standard library without invoking any DOS services (int 21h), only depend on BIOS service.

I am wondering whether there is any tool-chain could do it.

S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
user639642
  • 123
  • 1
  • 1
  • 5

4 Answers4

5

Check out the FreeDOS project. They have developer tools that include compilers, assemblers, and linkers. You'll probably have to modify the standard library, though, so that it uses BIOS calls rather than int 21h.

Jim Mischel
  • 131,090
  • 20
  • 188
  • 351
1

At a former job we had a project that was based on uc/OS running on a real-mode x86 platform. We used TopSpeed C rather than the more well-known Borland or Microsoft compilers, because TopSpeed C was the only one of the set available and viable at the time that got volatile right. Which you dearly need when building uc/OS. Both Turbo C and Microsoft C (and I think its QuickC too) miscompiled accesses to volatile variables - typically caching values in registers and similar breakage.

You'd have a hard time getting hold of TopSpeed C, though. And its assembler syntax is... unique. (I think it's based on Modula-2 or something; it ends up being very unlike MASM/TASM/nasm with which you may be 100 times more familiar.)

Bernd Jendrissek
  • 1,088
  • 6
  • 15
1

16-bit compilers? Several of them are mentioned here:

Is there a C compiler that targets the 8086?

Generally they are used for academic exercises, so if u target at educational institution you can find lots of examples too:

http://www.google.com.sg/search?q=site%3Aedu+C+compiler+8086

Community
  • 1
  • 1
Peter Teoh
  • 6,337
  • 4
  • 42
  • 58
-1

Check out any bootloader project, such as GRUB. It should be readily apparent that they also need everything you mentioned.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • Hello, as far as I know. Grub is running under protected mode on x86 – user639642 May 19 '11 at 19:30
  • 1
    @user639642: It starts in real mode, and I think it later sets up protected mode, but it definitely starts out in real mode (when the BIOS transfers control to the MBR). – Ben Voigt May 19 '11 at 19:45
  • 1
    I have take a look of grub2 and build it. It use gcc to compile. As far as I know, there isn't 16-bit real mode x86 assembly support in gcc. I guess the real mode part of grub2 is written in assembly. C is used under protected mode. – user639642 May 19 '11 at 20:30