I am working on porting uc/OS-II from DOS to x86 (real mode). I need:
A compiler to generate real mode 16-bit x86 assembly
An assembler to assemble the generated assembly into an object file
A linker to link the object files together and output an executable (raw binary, COFF, PE, or ELF formats are fine)
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.
16 bit compilers compile the program into 16-bit machine code that will run on a computer with a 16-bit processor. 16-bit machine code will run on a 32-bit processor, but 32-bit machine code will not run on a 16-bit processor. 32-bit machine code is usually faster than 16-bit machine code.
Turbo C is a 16 bit compiler so it compiles the code into a 16 bit machine code for the processor!
Open command prompt (Type “cmd” in search box). 8. Type “gcc –version” in command prompt to check whether C compiler is installed in your machine. Type “g++ –version” in command prompt to check whether C++ compiler is installed in your machine.
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.
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
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With