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.
对于我的汇编语言类,我们使用DPMI编写DOS程序。不幸的是,我无法一直访问32位Windows机器。我确实在我使用的每台计算机上安装了一个Debian虚拟机。
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).
我安装了DOSBox和DOSEMU。有什么办法可以在Linux而不是DOS中组装和编译程序吗?我正在使用nasm,所以我似乎没有任何问题得到它汇编DOS格式。但是,我无法通过编译器使用我的C代码运行它并获得DOS可执行文件(使用gcc或MinGW)。
Is there some way to do this or am I pretty much going to have to install all the tools under DOS?
有没有办法做到这一点,或者我几乎要在DOS下安装所有工具?
4 个解决方案
#1
7
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.
我甚至不确定你是否可以使用GCC编译DOS应用程序。很久以前有一个名为DJGPP的gcc编译器变体(或类似的东西)。我从来没有工作过。
The chances that you can cross-compile a GCC for DOS these days are almost zero.
这几天你可以为DOS交叉编译GCC的几率几乎为零。
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)
我建议你试试旧的Watcom编译器。它是一个原生的DOS编译器,它的DPMI实现也像DosBox下的一个魅力。与NASM编译的目标文件连接也不是问题(我这样做了几年)
Today the compiler has been made open source and called OpenWatcom.
今天编译器已经成为开源的,并称为OpenWatcom。
#2
8
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.
BCC是debian,能够为8080到80386生成合适的代码。使用-Md开关生成MS-DOS二进制文件。
#3
3
Probably the easiest way to go for you is to use the standard DOS tools for the task.
可能最简单的方法是使用标准DOS工具完成任务。
DOSBOX is a really good emulator.
DOSBOX是一个非常好的模拟器。
#4
2
DJGPP is ridiculously easy to install, bare minimum only three .ZIPs are needed:
DJGPP非常容易安装,最少只需要三个.ZIP需要:
-
BNU219B.ZIP
(assembler, linker, librarian) -
GCC441B.ZIP
(C compiler) -
DJDEV204.ZIP
(libc, headers)
BNU219B.ZIP(汇编程序,链接程序,库管理程序)
GCC441B.ZIP(C编译器)
DJDEV204.ZIP(libc,header)
http://www.delorie.com/djgpp/getting.html
unzip *.zip -d c:\djgpp &&
set DJGPP=c:\djgpp\djgpp.env &&
path c:\djgpp\bin;%PATH%
gcc myfile.c -o myfile.exe
To produce DOS-compatible output, you'll have to either use the DOS-hosted compiler in DOSEMU (not DOSBox!! way too slow and buggy, meant for games only) or use a Linux-hosted cross compiler (DJ's site has the RPMs for that).
要生成DOS兼容的输出,你必须要么在DOSEMU中使用DOS托管的编译器(不是DOSBox !!方式太慢而且错误,仅适用于游戏)或使用Linux托管的交叉编译器(DJ的网站有RPM)。
However, if you want 100% 16-bit code, you will have to use something else (e.g. OpenWatcom). OpenWatcom does also support Linux (beta!!) host and target (no shared libs, though, IIRC), but you may have to compile it yourself with GCC.
但是,如果您需要100%16位代码,则必须使用其他内容(例如OpenWatcom)。 OpenWatcom也支持Linux(beta !!)主机和目标(没有共享库,但是,IIRC),但你可能必须自己用GCC编译它。
#1
7
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.
我甚至不确定你是否可以使用GCC编译DOS应用程序。很久以前有一个名为DJGPP的gcc编译器变体(或类似的东西)。我从来没有工作过。
The chances that you can cross-compile a GCC for DOS these days are almost zero.
这几天你可以为DOS交叉编译GCC的几率几乎为零。
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)
我建议你试试旧的Watcom编译器。它是一个原生的DOS编译器,它的DPMI实现也像DosBox下的一个魅力。与NASM编译的目标文件连接也不是问题(我这样做了几年)
Today the compiler has been made open source and called OpenWatcom.
今天编译器已经成为开源的,并称为OpenWatcom。
#2
8
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.
BCC是debian,能够为8080到80386生成合适的代码。使用-Md开关生成MS-DOS二进制文件。
#3
3
Probably the easiest way to go for you is to use the standard DOS tools for the task.
可能最简单的方法是使用标准DOS工具完成任务。
DOSBOX is a really good emulator.
DOSBOX是一个非常好的模拟器。
#4
2
DJGPP is ridiculously easy to install, bare minimum only three .ZIPs are needed:
DJGPP非常容易安装,最少只需要三个.ZIP需要:
-
BNU219B.ZIP
(assembler, linker, librarian) -
GCC441B.ZIP
(C compiler) -
DJDEV204.ZIP
(libc, headers)
BNU219B.ZIP(汇编程序,链接程序,库管理程序)
GCC441B.ZIP(C编译器)
DJDEV204.ZIP(libc,header)
http://www.delorie.com/djgpp/getting.html
unzip *.zip -d c:\djgpp &&
set DJGPP=c:\djgpp\djgpp.env &&
path c:\djgpp\bin;%PATH%
gcc myfile.c -o myfile.exe
To produce DOS-compatible output, you'll have to either use the DOS-hosted compiler in DOSEMU (not DOSBox!! way too slow and buggy, meant for games only) or use a Linux-hosted cross compiler (DJ's site has the RPMs for that).
要生成DOS兼容的输出,你必须要么在DOSEMU中使用DOS托管的编译器(不是DOSBox !!方式太慢而且错误,仅适用于游戏)或使用Linux托管的交叉编译器(DJ的网站有RPM)。
However, if you want 100% 16-bit code, you will have to use something else (e.g. OpenWatcom). OpenWatcom does also support Linux (beta!!) host and target (no shared libs, though, IIRC), but you may have to compile it yourself with GCC.
但是,如果您需要100%16位代码,则必须使用其他内容(例如OpenWatcom)。 OpenWatcom也支持Linux(beta !!)主机和目标(没有共享库,但是,IIRC),但你可能必须自己用GCC编译它。