Is there a C compiler that targets the 8086?

Earlz picture Earlz · Dec 20, 2010 · Viewed 10.9k times · Source

I have an 8086 CPU emulator. It emulates only 8086 instructions. I am searching now for a C compiler to target this emulator with. Is there any C compiler out there that can do this?

Also, having a usable libc and such is not important to me. The emulator uses custom(ie, non-PC) hardware and therefor any libc or even ctr0 would probably have to be rewritten anyway

Answer

jschmier picture jschmier · Dec 20, 2010

bcc - Bruce's C compiler

From bcc(1) - Linux man page:

Description

Bcc is a simple C compiler that produces 8086 assembler, in addition compiler compile time options allow 80386 or 6809 versions. The compiler understands traditional K&R C with just the restriction that bit fields are mapped to one of the other integer types.

The default operation is to produce an 8086 executable called a.out from the source file.

Open Watcom

From the description of compiler option / 80x86 run-time convention 0 in Open Watcom C/C++ User’s Guide (PDF link):

(16-bit only) The compiler will make use of only 8086 instructions in the generated object code. This is the default. The resulting code will run on 8086 and all upward compatible processors. The macro __SW_0 will be predefined if "0" is selected