Is there a C compiler that targets the 8086? [closed]
Asked Answered
T

3

21

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

Telephony answered 20/12, 2010 at 19:19 Comment(7)
Any 16-bit DOS compiler.Emmetropia
Sadly, yes, too many of them, and too many college professors making their students use them....Infralapsarian
@R.. @Hans many of the compilers I've seen target higher up than the 8086, usually they go up to 8186 and 8286 opcodes.Telephony
@Telephony What about MS C compiler for DOS (QuickC) (as far as I remember, MS-DOS (or at least some core parts of it) never relied on anything above 8086, so..) One link I found (which reports tech problems at the moment) is vetusware.com/download/QuickC%202.51/?id=3503, and there're others too. Hope that will help you and (if too late) anyone interested.Lyublin
@mlv thanks but I was looking more for a modernish compiler supporting at least C89Telephony
Microsoft's QuickC may do it. But its so old, you may not be able to find it anywhere. I have the 1.44 floppy disks somewhere (there are 5 of them, IIRC). And Microsoft's MASM will surely do it if you don't mind some ASM.Erythroblastosis
Voting to close as tool rec. See also: #228262Spracklen
D
12

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

Destined answered 20/12, 2010 at 19:23 Comment(0)
G
7
Goar answered 20/12, 2010 at 19:28 Comment(4)
Are you sure Digital Mars will generate binaries using only 8086 opcodes?Telephony
@Earlz: Digital Mars can target the 8088, which is the same instruction set as the 8086: digitalmars.com/ctg/sc.html#dash023456Labroid
Another compiler that might be worth trying (I'm not sure though - it needs an MS-DOS environment to run in): Turbo C++ 2: edn.embarcadero.com/article/20841Labroid
@Mich no thanks, I'll stay as far away from Turbo C as possible lolTelephony
V
2

Free Pascal can also produce 16 bit 8086 executable. It is not a native compiler, you have to compile it on your contemporary 32/64 bit machine and then copy the executable to your 16 bit IBM 51XX or clone.

gcc-ia16 TK Chia's GCC compiler targeted for 8086. It is actively developed. It is used to compile a huge 16 bit project such as ELKS Linux and all its applications. It is also not a native compiler.

Vallation answered 17/1, 2020 at 11:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.