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? Running wcc -0 main.c from the command prompt produces just the OBJ file.
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). I am hoping the ASM file generated by Watcom would run without modification (copy-paste) in 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. In this case you would run something likewdis -l main
to readmain.obj
and produce a file namedmain.lst
that contains an assembly language listing.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 frommain.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. This option will also causes the disassembler's output to be written intomain.asm
rather thanmain.lst
. Sorry, I have no idea whether this output will be directly consumable by 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