The MASM Forum

General => The Workshop => Topic started by: nn5i on August 18, 2013, 03:40:07 AM

Title: How do you invoke ML.EXE?
Post by: nn5i on August 18, 2013, 03:40:07 AM
Hello -- I'm new here, but an extremely experienced assembler programmer (IBM 709,7090,1800,SYS/360-370-390, DEC, and others).  I've been using MASM 2.0 for decades for 16-bit code, and have written many hundreds of thousands of lines of it.

16-bit code has its limitations, and I wanted to do some updating, so I downloaded MASM32, alias ML, and tried to invoke it in DOS.  It came up, found my source (an old 16-bit progam of about 1000 lines), gave some cryptic error messages, and quit (as expected).

I can't find where it put the listing.  I can't find whether it put object code anywhere.  I see no way to TELL it where to put these things.  So I must be invoking it incorrectly.  I invoked it with a BAT file, as follows:

   D:
   ML /c D:\ASM\%1.asm

ML.exe and ML.err are in a directory, D:\EXE, that is in my path.

So what's the right way to invoke it?  Clearly not the way I'm doing it.
Title: Re: How do you invoke ML.EXE?
Post by: Vortex on August 18, 2013, 04:19:51 AM
ml.exe coming with Masm32 is for 32-bit Windows programming. You need to get the 16-bit version of ml.exe

EDIT : Thanks Jochen, I forgot it for a moment. My apologies, ml.exe V6 can assemble 16-bit code.
Title: Re: How do you invoke ML.EXE?
Post by: jj2007 on August 18, 2013, 04:23:11 AM
Hi nn5i,

Welcome to the Forum :icon14:

If you have 5 minutes, read Masm32_Tips_Tricks_and_Traps (http://www.webalice.it/jj2006/Masm32_Tips_Tricks_and_Traps.htm) to check if your setup is OK. For 16-bit code, you need \Masm32\bin\link16.exe

Masm32 uses hard-coded paths of the no-drive-but-root type, i.e. \Masm32\include\ etc; old-fashioned but very efficient.

Common problems include that people have sources on drive C: and Masm32 on D: - that can't work. Otherwise, your command line looks OK... add /Fl for a listing, if you need it, and use the /omf switch for ml 8.0 or higher. Any success in reading error messages and finding files?

D:\ASM\%1.asm looks a bit odd; what is passed as %1, does it expand to a valid path?
Check with
echo D:\ASM\%1.asm

@Erol aka Vortex: ML.exe as well as JWasm do handle 16-bit code. The linker needs to be different.

P.S: I've just added a crispy Dos example to MasmBasic (http://masm32.com/board/index.php?topic=94.0). Run \Masm32\RichMasm\RichMasm.exe, menu File/New Masm source, click on 16-bit app at the bottom, hit F6 :P
Title: Re: How do you invoke ML.EXE?
Post by: dedndave on August 18, 2013, 04:43:53 AM
notice what Jochen said about building projects on different drives
if the masm32 package is installed on D:, your project must be on D:

there are some possible work-arounds, if you are into batch programming

also, the package is set up to access specific root-relative paths
if you rename the folders, things aren't likely to work too well
Title: Re: How do you invoke ML.EXE?
Post by: Gunther on August 18, 2013, 05:26:48 AM
Hi nn5i,

welcome to the forum. Have fun.

Gunther
Title: Re: How do you invoke ML.EXE?
Post by: nn5i on August 18, 2013, 06:24:29 AM
Hi y'all --

Many thanks for the quick responses.  I don't want to do 16-bit programming with MASM32 -- I want to make new 32-bit programs, and new 32-bit versions of old programs.

Currently I have MASM32 on my K: drive and my source on D: (I have many drives) -- won't work, eh?  Odd.  But I can move the whole MASM32 structure to D: if that's what it takes.  My D: has lots of room available.

I'll read the suggested things, if I can find them.  Yes, my batch files expand correctly to point to my source.  I'd rather not move my source, though -- it's been where it is for a third of a century, and I'm used to it and my backup routines are used to it.

Is invoking it from a DOS prompt the norm, or is there some more modern way?  From the editor (which so far I don't particularly like), perhaps?  But maybe the suggested reading will answer that.

Thanks!  I'll be back.
Title: Re: How do you invoke ML.EXE?
Post by: dedndave on August 18, 2013, 08:08:30 AM
the Project menu in QE actually uses the batch files that are in the \masm32\bin folder
you can customize the build-menu behaviour of QE by modifying \masm32\menus.ini

a while back, i wrote more comprehensive (all-in-one) batch file, that will perform several types of builds

http://masm32.com/board/index.php?topic=1770 (http://masm32.com/board/index.php?topic=1770)

now, as for moving the project and/or masm32 folders....

you don't really need the entire masm32 package to build
you need some of the batch files and EXE binaries from \masm32\bin
you also need the following folders:
\masm32\include
\masm32\lib
\masm32\macros

by the way...
is your name Carl ?
Title: Re: How do you invoke ML.EXE?
Post by: nn5i on August 18, 2013, 10:08:09 AM
Yup, I'm Carl.  I'll go quietly, put the cuffs on me.  When I figure out how to add a signature here, I'll do so.  And maybe an avatar, too.

After using that editor a bit, I like it much better -- and I even figured out how to invoke the assembler from it; which is a great convenience.  Don't know how to create a listing yet, but I'm moving along.  Also don't know where it's going to put the EXE file (which I assume it's going to make) when it decides to do a link (when I get a clean assembly, I guess), but I can hunt it down if necessary.

32-bit code is much more compact, to my surprise (though I ought to have expected it).  But some of my stuff goes to tens of thousands of lines, and a listing is essential for debugging.  It is nice not to have to worry about segment sizes!
Title: Re: How do you invoke ML.EXE?
Post by: dedndave on August 18, 2013, 10:14:16 AM
Dave here - K7NL   :P

to create a listing, you have to add 1 or more switches to the ML command line
you can either modify the existing batch file, or create a new one

unlike old versions of MASM, the switches are generally placed before the file names

to create a listing, add "/Fl" <- that's a lower case L
there are several possible modifiers - see the ones listed below starting with the letter S

       ML [ /options ] filelist [ /link linkoptions ]

/AT Enable tiny model (.COM file)         /omf generate OMF format object file
/Bl<linker> Use alternate linker          /Sa Maximize source listing
/c Assemble without linking               /Sc Generate timings in listing
/Cp Preserve case of user identifiers     /Sf Generate first pass listing
/Cu Map all identifiers to upper case     /Sl<width> Set line width
/Cx Preserve case in publics, externs     /Sn Suppress symbol-table listing
/coff generate COFF format object file    /Sp<length> Set page length
/D<name>[=text] Define text macro         /Ss<string> Set subtitle
/EP Output preprocessed listing to stdout /St<string> Set title
/F <hex> Set stack size (bytes)           /Sx List false conditionals
/Fe<file> Name executable                 /Ta<file> Assemble non-.ASM file
/Fl[file] Generate listing                /w Same as /W0 /WX
/Fm[file] Generate map                    /WX Treat warnings as errors
/Fo<file> Name object file                /W<number> Set warning level
/FPi Generate 80x87 emulator encoding     /X Ignore INCLUDE environment path
/Fr[file] Generate limited browser info   /Zd Add line number debug info
/FR[file] Generate full browser info      /Zf Make all symbols public
/G<c|d|z> Use Pascal, C, or Stdcall calls /Zi Add symbolic debug info
/H<number> Set max external name length   /Zm Enable MASM 5.10 compatibility
/I<name> Add include path                 /Zp[n] Set structure alignment
/link <linker options and libraries>      /Zs Perform syntax check only
/nologo Suppress copyright message


the resulting EXE should end up in the same folder as the ASM file
Title: Re: How do you invoke ML.EXE?
Post by: nidud on August 18, 2013, 11:56:44 PM
deleted
Title: Re: How do you invoke ML.EXE?
Post by: dedndave on August 19, 2013, 12:47:33 AM
"nn5i" follows a specific format - lol
it tipped me off to the fact that he's a fellow amateur radio operator   :biggrin:
Title: Re: How do you invoke ML.EXE?
Post by: nidud on August 19, 2013, 01:29:30 AM
deleted
Title: Re: How do you invoke ML.EXE?
Post by: dedndave on August 19, 2013, 04:26:48 AM
US call-signs begin with A, K, N, or W
they start with 1 or 2 letters, then a single digit, followed by 1 to 3 letters
"2 by 1" and "1 by 2" call-signs are generally reserved for those with an "extra" class license
"1 by 1" call-signs are only issued for special event stations

if it has no numbers, it's a commercial or government station
if it starts with "N" and has a bunch of numbers, it's an aircraft
if it starts with "K" and has a bunch of numbers, it's a CB'er
most CB'ers don't even apply for a license, though - lol
Title: Re: How do you invoke ML.EXE?
Post by: nidud on August 19, 2013, 05:26:00 AM
deleted
Title: Re: How do you invoke ML.EXE?
Post by: dedndave on August 19, 2013, 01:39:17 PM
many hams in Norway
the hard ones to find in Europe are Luxembourg, Gibraltar, etc - all the little ones
sorry to hear of LA8PV's passing - don't think i ever talked with him, but maybe
i have been a ham for 45 years - hard to remember them all
Title: Re: How do you invoke ML.EXE?
Post by: nidud on August 19, 2013, 02:07:31 PM
deleted