1313ed01
10 hours ago
To the list of compiler listed I want to mention this one as well, that is my compiler of choice for 16-bit C in (Free)DOS these days (because it has a MIT license, it's very small, and it runs great inside of DOS itself so no need to mess with cross-compilation and I know if I have an environment like FreeDOS or DOSBox set up I can both compile and run my code, and I will never have to re-install or reconfigure anything when moving between different host systems):
https://github.com/microsoft/MS-DOS/tree/main/v4.0/src/TOOLS
(Not only Microsoft's C compiler in that directory, but also MASM, MAKE, and a bunch of other tools. 1-2 MB of files and you have an entire toolchain for 16-bit DOS.)
kragen
9 hours ago
Interesting, "All files within this repo are released under the MIT License as per the LICENSE file stored in the root of this repo," but did they include the source for the toolchain? I may be looking in the wrong place...
1313ed01
9 hours ago
No, but that MIT license does not say anything about sharing the source code, so just sharing the binaries should be fine. (Not a lawyer.)
( * Also thanks for mentioning MIT. My comment said BSD, but I fixed that now.)
kragen
9 hours ago
Yeah, I didn't mean it was illegal, just that you might have an unnecessarily hard time fixing compiler bugs and understanding how the toolchain works.
1313ed01
9 hours ago
Yes, of course. Source code would be nice, but I gamble on that there wasn't a terrible amount of bugs in that compiler. It is version 5.10, so not the first 5.x release, plus with the lack of good ways to distribute patches back then we all know software tended to be better tested. It also obviously works well enough to compile DOS 4.0 (and a bunch of user tools that are included) plus I have tried it already for some quite big code-bases without noticing anything being broken.
I feel like any bugs can probably be worked around and since it is C it is possible some things can be fixed by adding some macros in the include-files. I have thought of making some minor changes to the include-files to modify some of the few things I noticed that are missing from C89. I do not know if it is possible to make it 100% C89 compliant or if the binaries would have to be patched for that, but it seems like it already is 99% of the way.
* Since I can't comment on the comment to this post: Note I said C89. Definitely not going to go for anything more modern. Possibly add the standard integer size types from C99, as those can be useful for more portable code. There are other, bigger, compilers for more modern C versions that can cross-compile to DOS (and also Free Pascal that seems like a nice language for that).
kragen
9 hours ago
Oh, yeah, you're definitely going to have a harder time adding C99 support to it than to OpenWatcom, not to mention C11, C17, and C23. Which matters if you're writing new code.