简体   繁体   English

C源代码,Watcom编译器和EMU8086

[英]C source code, Watcom Compiler and EMU8086

How can I get the Watcom compiler (the forked version 2.0 beta which runs on 64-bit hosts) to output 8086 assembly source code in an ASM file? 如何获得Watcom编译器(在64位主机上运行的分叉版2.0 beta)在ASM文件中输出8086程序集源代码 Running wcc -0 main.c from the command prompt produces just the OBJ file. 从命令提示符运行wcc -0 main.c只会生成OBJ文件。

As a side note, my main task it to convert C source code to assembly code that I can run with EMU8086 (instead of writing the actual assembly code). 附带说明一下,我的主要任务是将C源代码转换为可以与EMU8086一起运行的汇编代码(而不是编写实际的汇编代码)。 I am hoping the ASM file generated by Watcom would run without modification (copy-paste) in EMU8086. 我希望Watcom生成的ASM文件可以在EMU8086中运行而无需修改(复制粘贴)。

I don't see a way to get the Watcom compiler to generate an ASM file directly, but you should be able to use the Watcom disassembler ( wdis ) to generate an assembly listing from the object file produced by the compiler. 我没有找到让Watcom编译器直接生成ASM文件的方法,但是您应该能够使用Watcom反汇编程序( wdis )从编译器生成的目标文件中生成程序集列表。 In this case you would run something like wdis -l main to read main.obj and produce a file named main.lst that contains an assembly language listing. 在这种情况下,您将运行wdis -l main以读取main.obj并生成一个名为main.lst的文件,其中包含汇编语言列表。

If you recompile main.c with a -d1 or -d2 option to place extra debugging data into the main.obj file then you can use the disassembler's -s option to have the assembly language listing interpersed with comments showing the original C source from main.c . 如果使用-d1-d2选项重新编译main.c以将额外的调试数据放入main.obj文件中,则可以使用反汇编程序的-s选项使汇编语言列表与注释混合,以显示来自main.c的原始C源代码。 main.c

To get the disassembler to omit descriptive comments and just give a plain disassembly that should be acceptable as a source file for the Watcom assembler, give the -a option to the disassembler. 要使反汇编器省略描述性注释,并仅给出应作为Watcom汇编器源文件接受的普通反汇编,请为反汇编器提供-a选项。 This option will also causes the disassembler's output to be written into main.asm rather than main.lst . 此选项还将使反汇编程序的输出写入main.asm而不是main.lst Sorry, I have no idea whether this output will be directly consumable by EMU8086. 抱歉,我不知道此输出是否将由EMU8086直接消耗。

This is all discussed in the Open Watcom C/C++ User Guide and C/C++ Tools User Guide linked from http://www.openwatcom.com/doc.php http://www.openwatcom.com/doc.php链接的《 Open Watcom C / C ++用户指南》和《 C / C ++工具用户指南》中都对此进行了讨论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM