News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

directed listing

Started by Gonzo, October 29, 2005, 04:58:47 PM

Previous topic - Next topic

Gonzo

I finally managed to figure how to get the compiler to create the full listing I want, some of that info coming from searches here, especially in the Workshop via a posting by MichaelW and subsequent responses.  I would like to refine the .bat files involved to put the listing file in a directory other than the one containing the source.  The command line \masm32\bin/ml (etc) /Fl"%1.lst" will create the listing I want, however, the variable %1 contains directory information I don't want...what I DO want is just the name of the module being assembled so I can direct the listing to the folder I choose.

I realize this is more a DOS batch file question, however, been searching the 'net for a few hours, cannot find how to substring out just the name from the %1 variable.

Thanks for your help.

Gonz

Jeff

#1
just use the /Fl flag without the name.  it defaults to the source file name.

[edit]
sorry, misread the post again.  :)

MichaelW

This worked OK under Windows 2000 so it will probably work under Windows XP, but I don't know about Windows 9x.

Test.bat:

@echo off
echo %1
echo %1 > tempfile.txt
for /f "tokens=1,1" %%I in (tempfile.txt) do set name=%%~nI
echo %name%
pause

Runtest.bat:

@echo off
call test c:\masm32\my\junk
pause


For more information, start a CMD processor and enter HELP FOR.
eschew obfuscation

Gonzo

Jeff -

This doesn't get what I want.  The %1 variable contains directory information as noted and the .lst file gets placed in that directory.  For example: in Qeditor I edited textio.asm from examples\example3\textio.  I added just Fl to the command line in assmbl.bat, ran Assemble ASM File in Project and the .lst file was placed along with the .obj file in examples\example3\textio - not what I wanted.  I'm old school main frame assembly language programmer...I want all my source in one library, ojbects in another, listings in another and load modules (executables) in another.

Gonz

Gonzo

Michael -

I thought perhaps FOR was going to be the answer.  I'm running W2K.  Shall give it a shot.  Thanks.

Gonz

Gonzo

fwiw in the event there are other anal types like me out there, the following works on W2K:


echo %1 > tempfile.txt
for /f "tokens=1,1" %%I in (tempfile.txt) do set mod=%%~nI

if exist \masm32\obj\%mod%.obj del \masm32\obj\%mod%.obj

\masm32\bin\ml /c /coff /Sn /Fl\masm32\lst\%mod% /Fo\masm32\obj\%mod% "%1.asm" > \masm32\log\%mod%.log

Sorry - I don't know how to do the trick editing on this bbs.

G

PBrennick

Gonzo,
Above the edit box and above the smilies, you will find a button with '#' on it.  This will insert the code tags into the edit box.  Next you put the code between the tags and that's it.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

MazeGen

These lines


echo %1 > tempfile.txt
for /f "tokens=1,1" %%I in (tempfile.txt) do set mod=%%~nI


could be simplified to

for /f %%I in ("%1") do set mod=%%~nI

No need for the temp file. Default token is token 1.

Gonzo

Quote from: PBrennick on October 30, 2005, 04:20:02 PM
Gonzo,
Above the edit box and above the smilies, you will find a button with '#' on it.  This will insert the code tags into the edit box.  Next you put the code between the tags and that's it.

Paul


Rather like
Now is the time for all good men

Eh?  Thanks for the tip.  Now I'm hoping I have found how to respond to particular posts as well.

Gonz

Gonzo

Quote from: MazeGen on October 30, 2005, 08:20:43 PM
These lines


echo %1 > tempfile.txt
for /f "tokens=1,1" %%I in (tempfile.txt) do set mod=%%~nI


could be simplified to

for /f %%I in ("%1") do set mod=%%~nI

No need for the temp file. Default token is token 1.

Ahhh...very clean, works like a champ.  Thanks.

I wonder if anyone now knows how to direct the output from link.  The prototype from /? yields only

LINK [options] [files] [@commandfile]

That provides zero information about [files], format, etc.  Any ideas?


Gonz

MazeGen

Quote from: Gonzo on October 31, 2005, 07:07:17 PM
I wonder if anyone now knows how to direct the output from link.  The prototype from /? yields only

LINK [options] [files] [@commandfile]

That provides zero information about [files], format, etc.  Any ideas?


Gonz

If you mean linker options, look at msdn: Linker Options

From command line, try link /? >link.txt

P1

Leave the "%1.lst" as is.

Just add the copy to where you want.

Copy *.lst c:\masm32\mylistings\*.lst
Del *.lst

Regards,  P1  :8)

Gonzo

Quote from: MazeGen on November 01, 2005, 01:07:30 PM

If you mean linker options, look at msdn: Linker Options

From command line, try link /? >link.txt

Thanks Maze.  I have to retrain from reaching for IBM manuals on shelves!  This is great info.

Gonz

Gonzo

Quote from: P1 on November 01, 2005, 01:57:07 PM
Leave the "%1.lst" as is.

Just add the copy to where you want.

Copy *.lst c:\masm32\mylistings\*.lst
Del *.lst

Regards,  P1  :8)

p1 -

I considered doing that, however, I KNEW there was a way within the batch file to parse out the values and get the output file directed where I wanted.   Besides, with the parsing, it is trick.... :bg

Gonz