Software Archive
Read-only legacy content
17061 Discussions

MASM switches that will compile asm listings

hbell
Beginner
618 Views
Does anybody know which MASM switches are required in order compile assembly listings?
0 Kudos
5 Replies
hbell
Beginner
618 Views
I found the answer to my question. I realize I had asked the same question several months ago and received an authoritative answer from a Compaq assembly language expert. Here is the answer that I had misplaced until now:
The Microsoft Macro Assembler (MASM) command line for properly assembling the asm listing files produced (optionally produced when compiling a CVF program) into .obj files is:
ML /I. /Zm /Cp /Fl /Sa filename.asm
0 Kudos
TimP
Honored Contributor III
618 Views
Does anyone have a patch file which would add the opcodes employed by CVF with /arch=p6? The MASM which we have available is about 9 years old and requires me to run 486 instructions.
0 Kudos
Steven_L_Intel1
Employee
618 Views
Well, Microsoft's Visual C++ 6.0 Processor Pack seems to claim that it contains a MASM with the latest processor instructions (assuming I can read between the lines of the MS documentation correctly - haven't tried it yet myself.)

Steve
0 Kudos
TimP
Honored Contributor III
618 Views
Yes, after installing Visual Studio SP5 and the corresponding processor pack, changing the .486 to .686 in asmfile enables ML to assemble the p6 code. Required options appear to be:
ML -Zi -c -coff -Zm ...

-Zi enables Vtune to display the .asm source.
0 Kudos
hbell
Beginner
618 Views
I noticed a few things since I started this thread. First off, the version of MASM discussed above is 6.15. Also, it may be that those MASM options required to replicate the object file from an asm listing that was produced by a CVF compile-link of Fortran source code differ from the options a user would use in writing an assembly program from scratch. Another MASM switch that may be important is -Zp4 (to align structures along 4-byte boundaries). Also, one of the reasons I wanted to re-assemble an asm listing was to generate timings for each assembly instruction (not given in the CVF asm listings); this requires the -Sc switch.
So here is what I think should be a good set of switches to compile assembly language code into an CVF-compatible object file (especially if you are trying to get an insight into exactly how your Fortran code compiled from the CVF asm listing):

ML.EXE -I. -Zm -Cp -Fl -Sa -Sc -coff -Zp4 -c asmlistingfile.asm

One more thing, even with older assembler versions one can always embed the newer processor instructions by directly embedding op codes using the "DB" (define byte command). For example to encode a CPUID instruction insert the two lines: "db 0fh" then "db 0a2h" (see Intel documentation AP-485 on this particular example and on the CPUID instruction in general).
0 Kudos
Reply