News:

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

ASM File name

Started by Robert Collins, January 06, 2005, 05:29:22 AM

Previous topic - Next topic

Robert Collins

If I have a file with the name 'abcdefg.asm', MASM assembles it OK but if the file name is 'abcdefgh.asm' then MASM appears to be prompting for me to input something. Is there something I need to input or is this just a quirk because I added one more letter to the file name? Is there a limit to the number of characters you are allowed in the file name and if so is it a MASM restriction or a restriction imposed by the system?

hutch--

Without knowing how you are trying to build the file, try,

ml.exe /c /coff "long_file_name.asm"

and see if it works.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Robert Collins

It does the same thing whether I use your statement in a .bat file or I use the 'Assemble and Link' option of QEditor

BogdanOntanu

What version of MASM are you using?
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

MichaelW

Robert,

You should not be having this problem with an 8.3 name like abcdefgh.asm, or for recent versions of MASM, with a long file name up to at least 260 bytes, and in some cases much longer. Problems should occur only if the name contains illegal characters or embedded spaces. The normal solution for embedded spaces is to place the name in double quotes.
eschew obfuscation

hutch--

The attached file is called "long file name.asm" and it builds with a batch file that was built with a standard option in MASM32 from the QE menu.

Tested with ML.EXE versions 6.14 and 7.00.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

Hi Robert,

I suspect you are using an old version of ml.exe

Robert Collins

I have absolutely no explanation as to what is going on. I have a do-nothing ASM file called 'long_file_name.asm' I save a copy of it in two different directories. Both files are exactly the same.  In one directory it assembles as I said earlier, MASM just sits there waiting for me to input something. In the other directory it assembles OK. I am using v6.14 of ml.exe.

Robert Collins

Just to test the name I copied the same file to several other directories. I went into each directory where I had saved a copy of the file and took note as to whether it assembled or not. In some directories it assembled OK while in other directories it did not. All of the directories where it did not assemble I noticed were nested several directories down from the root directory and in the directories where it did assemble OK were at least one directory level higher up. It appears that either MASM cannot assemble if the file is too many levels down or the length of the entire path is too long. Does that make sense?

P1

Quote from: Robert Collins on January 06, 2005, 05:18:41 PM
Just to test the name I copied the same file to several other directories. I went into each directory where I had saved a copy of the file and took note as to whether it assembled or not. In some directories it assembled OK while in other directories it did not. All of the directories where it did not assemble I noticed were nested several directories down from the root directory and in the directories where it did assemble OK were at least one directory level higher up. It appears that either MASM cannot assemble if the file is too many levels down or the length of the entire path is too long. Does that make sense?
Yes & No, not yet, But does any of these 'failed to assemble paths' have spaces in them?  That is your first clue that you are using old batch files from QEditor to build your files with.  For you to use other than DOS paths on a newer OS, you must use batch files that have the new "Quoted Paths in them".  Like, look for:REM BLDALL.bat
@echo off

if not exist rsrc.rc goto over1
\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

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

rem \masm32\bin\ml /c /coff "%1.asm"     ;Old line
\masm32\bin\ml /c /coff "%1.asm" > "%1.txt"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /FILEALIGN:512 /SUBSYSTEM:WINDOWS "%1.obj" rsrc.obj
if errorlevel 1 goto errlink

dir "%1.*"
goto TheEnd

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

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause
Please check this out and report back. 

Regards,  P1  :8)

Robert Collins

Some of the paths have underscores in them but I don't think that was causing the problem because at the bottom of this path it did not assemble but one level up it did assemble and both folders were still under the root of a folder with underscores in it.

However, your batch file works in all directories. So, is it that I must put the path and file name in quotes?

Also, why in your batch file do you have the following?:


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


Would not a successful re-assembly of the file overwrite the old .obj and .exe files anyway?

jimh

I have had some similar problems recently.

1. Path with spaces.
    ->  c:\projects\asm\test folder\app1\app1.asm
    ->  "Build All" from QEditor gives in the cmd window:   Assembling: c:\projects\asm\test.asm

2. "Current Path" issue.
    ->  Drag any .asm file from a folder to QEditor desktop icon.
    ->  Project|Assemble ASM File places the intermediate .obj file in the /masm32 folder, causing any subsequent linking to fail.

I haven't quite done enough testing to come up with any elegant solutions yet, but I like the "quick" part of QEditor so I'll keep looking at the batch file... might have to do some path testing.

hutch--

I actually posted the example for a reason, it DOES work. The batch file that builds it is as follows. The batch file was built with a standard MASM32 script from the editor under the option "Script" then "Create makeit.bat". Run the script, type in the long file name you like and BINGO, it will build the file with the long file name.


@echo off

if not exist rsrc.rc goto over1
\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

if exist "long file name.obj" del "long file name.obj"
if exist "long file name.exe" del "long file name.exe"

\masm32\bin\ml /c /coff "long file name.asm"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /SUBSYSTEM:WINDOWS "long file name.obj" rsrc.res
if errorlevel 1 goto errlink

dir "long file name.*"
goto TheEnd

:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS "long file name.obj"
if errorlevel 1 goto errlink
dir "long file name.*"
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Robert Collins

Yes, that batch file works. Alot of time as I do alot of code changing I like to use the quickie 'Assemble and Link' feature fo QEditor and that is where I am having the problem.

However, I did some futher testing and found that all the files that did not assemble were those that were on the last chain of a multi-level directory tree. For example: c:\Assembly32\Stuff_That_I_Am_Working_On\Winsock_Examples\My_First_Winsock_Project\My_First_Winsock_Program.asm would not assemble but if I copied that file name to the next level up directory it would assemble.

Does not assemble:
c:\Assembly32\Stuff_That_I_Am_Working_On\Winsock_Examples\My_First_Winsock_Project\My_First_Winsock_Program.asm

Does assemble:
c:\Assembly32\Stuff_That_I_Am_Working_On\Winsock_Examples\My_First_Winsock_Program.asm

So, I was thinking that maybe it's because it is buried too deep into the directory tree structure. So I renamed all of the directories to:

c:\Assembly32\My_Stuff\Winsock_Examples\My_First_Winsock_Project\My_First_Winsock_Program.asm

The number of levels is the same but I shortened the name of the 1st sub folder. The above assembled corectely. This makes me think that it is not so much the length of the file name but rather the length of the entire path to the file.

If I use your batch example I have no problems whatsoever no matter when the file is but if I use the 'Assemble and Link' feature of QEditor then I will have those problems.

If QEditor uses a batch file that is in the masm32 directory somewhere then I can simply change that batch file to one that works but I am not sure about this.

jimh

Sorry if there was any confusion.  I understood your example .bat file...it works fine for its purpose; I have a similar batch file that I copy to my project folder and change a variable at the top of the file.  I also understand the Script|Create makeit.bat menu option.  What I was having problems with was the Project|Build All menu not keeping the current path (of the loaded .asm file) and placing intermediate .obj files in the \masm32 folder.  Now if I want to use Project|Build All, I just keep spaces out of the path, click File|Set Current Directory when I open a new file, and (heh heh... old habits die hard) try not to hit the Esc key.