Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compile DOS programs on Debian?

For my assembly language class, we're writing DOS programs using DPMI. Unfortunately, I don't have access to a 32-bit windows machine all the time. I do have a Debian virtual machine installed on just about every computer I do use.

I've got both DOSBox and DOSEMU installed. Is there any way that I can assemble and compile the programs in Linux rather than DOS? I'm using nasm, so I don't seem to have any problems getting it assembledin DOS format. However, I'm having trouble running it through the compiler with my C code and getting a DOS executable (using either gcc or MinGW).

Is there some way to do this or am I pretty much going to have to install all the tools under DOS?

like image 592
Jason Baker Avatar asked Mar 15 '09 14:03

Jason Baker


People also ask

Does Linux use DOS?

Linux uses the standard MS-DOS partitioning scheme, so it can share your disk with other operating systems. Linux has loadable kernel modules for (presumably) all versions of Microsoft FAT and VFAT file systems, including Windows 2000 and WindowsMe.


2 Answers

I'm not even sure if you can compile DOS applications using GCC. A long time ago there was a gcc compiler-variant called DJGPP (or something like that). I never got it working though.

The chances that you can cross-compile a GCC for DOS these days are almost zero.

I suggest you give the old Watcom Compiler a try. It's a native DOS compiler and it's DPMI implementation also works like a charm under DosBox. Interfacing with NASM compiled object files is not a problem either (I did that a couple of years)

Today the compiler has been made open source and called OpenWatcom.

http://www.openwatcom.org/index.php/Main_Page

like image 78
Nils Pipenbrinck Avatar answered Oct 18 '22 17:10

Nils Pipenbrinck


BCC is in debian, and is capable of producing decent code for 8080 up to 80386. Use the -Md switch to produce an MS-DOS binary.

like image 20
LiraNuna Avatar answered Oct 18 '22 17:10

LiraNuna