The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: wally on February 16, 2011, 03:59:02 PM

Title: MASM assembler output listing
Post by: wally on February 16, 2011, 03:59:02 PM
Hi All,

I just started playing with MASM but one thing is bugging me:
How do I get a listing, that I can print, of the assembler code together with the corresponding compiled and linked hex machine code?
I can get somewhere near by dis-assembling the resultant .exe file, but obviously no comments or other assembler text.

Pointer would be appreciated.

Title: Re: MASM assembler output listing
Post by: dedndave on February 16, 2011, 04:19:35 PM
if you assemble with the /Fl (lower case L) switch, it will generate a listing
however, there are a few options to control what goes into the listing - mostly starting with the letter S
for a complete list of switches....
ML /?
Title: Re: MASM assembler output listing
Post by: wally on February 17, 2011, 01:06:21 PM
Thanks for that, I have been trying to drive things from the MASM GUI, I see no way to accomplish that from GUI so I guess I must drop down to console.

I found ML.exe and then the MASM help, I seem to be missing some general tutorial about using the system, can you point me anywhere? I see no way of setting some 'options' that would assemble the listing from the GUI menu.

The GUI Help seems to focus on specific points, i.e. the trees rather than the wood!

Any extra help appreciated.

Title: Re: MASM assembler output listing
Post by: dedndave on February 17, 2011, 04:08:32 PM
if you are refering to QEditor, i believe it uses the batch files that reside in the  \masm32\bin  folder:

build.bat is for GUI apps
buildc.bat is for console apps

you should be able to modify those   :U
Title: Re: MASM assembler output listing
Post by: wally on February 18, 2011, 09:33:39 AM
Thanks, I'll take a look at that.
Title: Re: MASM assembler output listing
Post by: Magnum on February 18, 2011, 12:03:01 PM
You can put this in your Qeditor menu to generate a listing file.

&Listing_Build,\MASM32\BIN\listing.bat "{b}"

-----------------------------------------------------------------

And put this in \masm32\bin

:: Listing.bat

@echo off

if exist %1.obj del %1.obj
if exist %1.exe del %1.exe

@echo %1

\masm32\bin\ml /Fl /c /coff %1.asm
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF %1.obj rsrc.obj
if errorlevel 1 goto errlink

dir "1.*
goto TheEnd

:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF %1.obj
if errorlevel 1 goto errlink
dir %1.*
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause
Title: Re: MASM assembler output listing
Post by: wally on February 19, 2011, 08:44:47 AM
Thanks a lot, will try later.

I'm not initially sure what the process is. "put this in your Qeditor menu", how do I do that?

It appears I need to generate a listing.bat file that gets triggered from a new menu entry.

As I said to dedndave, I seem to missing some help document here. Help seems to focus on the trees rather than the wood.

Throw me a bone..
Title: Re: MASM assembler output listing
Post by: wally on February 19, 2011, 12:58:11 PM
Magnum,

I figured it out, read the QEditor help. I need to make a more structured effort to understand these bits and pieces.