2

I'm looking for a C cross-compiler and emulator for a 16-bit processor that runs under Linux. I'd prefer for the target to be 8086 with FreeDOS or on Dosemu (then finding an emulator is not a problem). One limiting factor is that it needs to support 64-bit arithmetic.

The goal is to port and test some code that currently targets 32-bit embedded systems to 16-bit systems for which I don't have easy access development tools and emulators. The code is mostly portable apart from currently assuming that int is 32-bit, so any 16-bit target will do for the continuous integration testing.

The constraints:

  • The compiler and the emulator must run under Linux, in an automated build and test environment.
  • In the emulator, I need to be able to run my program and get data in and out. I would need either a basic OS, or some code to link into my program to implement serial or file I/O (ideally both but as long as I have a way to provide the test data and retrieve the results it should be fine). DOS (on 8086) would be nice because there's existing tooling around it, but it isn't a requirement.
  • The software should be free to run. A license that doesn't allow redistributing the binaries produced by the compiler would be ok (I only need the binaries for internal testing). A license that prohibits all commercial use wouldn't work for me right now (although I might get a purchase approval later).
  • The compiler needs to support the following features:

    • 8-bit char
    • 16-bit int
    • Ideally C99, but if not then at least 64-bit integers (uint64_t).
    • The better the warnings about integer sizes the better, since this is code that hadn't been written for a 16-bit target in the first place.

1 Answer 1

0

Open Watcom C/C++ (old website, v2 fork supports 16-bit x86 targets including DOS. It can produce executables that run in Dosbox. It's free. It supports C (up to C99, at least including stdint.h and long long), C++ and Fortran.

I ended up using this for my project, but only for a short length of time because I ended up gaining access to the real target platform soon after. So I can't comment on the extensiveness of its warnings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.