How do you make a .com file for MS-DOS? I have my own “operating system”, PowerOS, and I want custom commands to be able to be entered. Is there any way to write a .com file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The answer is fairly straightforward. You make a
.COMfile containing an MS/PC/DR-DOS program image by writing a program in a programming language and compiling it with a compiler that targets MS/PC/DR-DOS. That’s it.Don’t get confused about filename extensions. There’s a
.COMprogram image file format, which is a fairly basic program image format. It was superseded by the “MZ” program image file format back in the 1980s. But it has nothing to do with the filename extension. A program image file for MS/PC/DR-DOS can have either the extension.COMor the extension.EXE, but the actual image file format is not dictated by this. (I mention DR-DOS. If memory serves correctly: In DR-DOS version 6 practically all of the program image files, even the ones named.COM, were actually “MZ” format executables, and compressed ones at that.)What you do depends from what program image file formats your operating system’s program loader is capable of understanding. And, really, only you can tell the world that. If your operating system’s program loader understands the “MZ” executable file format, and the programs that run on your operating system are 16-bit and run in real mode, then compiling commands for your operating system is as simple (ignoring system call and library issues) as, say, cranking up OpenWatcom‘s 16-bit compiler+linker,
wcl, and telling it to target MS/PC/DR-DOS with the-bcl=DOSoption.Of course, if your programs are 32-bit and your operating system runs them in protected mode, or even if your programs are 16-bit and your operating system runs them in protected mode, then the “MZ” file format will be unsuitable for your needs, and you should use one of the several alternative program image file formats.