The MASM Forum

Miscellaneous => 16 bit DOS Programming => Topic started by: Ehsanullah on November 10, 2013, 01:07:18 AM

Title: what is the maximum length of masm 16 file Name
Post by: Ehsanullah on November 10, 2013, 01:07:18 AM
Hi,

in one of my lab task i name my masam file like : "Lab1_Question_1.ams" (which is 15 character long  :biggrin: ) when i assembled that file using make16 it gave this error LINK:fatal error L1093 object not found. but when i renamed the file into lab1q1.asm then it assembled the file. Here i must mention that i didn't bring any changing in the code ;Not a single character was changed..

so my question is that is there a limitation in file name length of masm?
If yes then what is the maximum length?
and which characters should be avoided while naming a file..

Thank you...
Title: Re: what is the maximum length of masm 16 file Name
Post by: jj2007 on November 10, 2013, 01:58:10 AM
Just tried to build a 16-bit app with a long name, and it works with RichMasm, even with the old 6.14 assembler. What is make16, a batch file?

If the problem persists, use these two lines in your batch file:
\masm32\bin\ml /c %1.asm
\masm32\bin\Link16 %1.obj;
Title: Re: what is the maximum length of masm 16 file Name
Post by: Ehsanullah on November 10, 2013, 02:04:18 AM
thanks...
Title: Re: what is the maximum length of masm 16 file Name
Post by: Tedd on November 13, 2013, 07:18:38 AM
DOS file names were limited to 8 characters for the 'name,' plus 3 more for the file-type extension.
Valid characters were limited to: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$%'-_@~`!(){}^#&
And that's all; no lower case, no spaces, no other characters. (Lowercase is automatically converted to upper.)

That was 'old' DOS, and those names should be safe and valid.
However, various attempts at extending compatibility were added to the 'new' DOS functions in Windows, which should allow for most programs to still work correctly with 'long' file names (a 'short' 8+3 file name is automatically generated.) So that may or may not be your problem :P

Title: Re: what is the maximum length of masm 16 file Name
Post by: Rockphorr on November 17, 2013, 06:58:12 AM
length of path returned by get_current_folder of int 21h is 40h
length of file name is 0Ch
length of first <drive_name>:\ is 3
length of last zero is 1

total required bytes are 3+40h+0Ch+1 to load something like

db c:\windows\command\edit.com
db 0
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 17, 2013, 10:08:06 AM
I renamed a com file by a name greater than the 8 + 3 convention.

When run, it returned "Bad command."

Outta here,
                    Andy

But you can use a lot of extended characters in the filename to come up with many thousands of file name possibilities.
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 17, 2013, 11:59:56 AM
seems to work here, Andy
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Masm32\Asm16\16-Bit Templates => blahblahblah
Hello World !

C:\Masm32\Asm16\16-BIT~1 =>


don't forget - if the path/file contains spaces, enclose it with "double quotes"
Title: Re: what is the maximum length of masm 16 file Name
Post by: Gunther on November 17, 2013, 12:07:14 PM
Dave,

Quote from: dedndave on November 17, 2013, 11:59:56 AM
don't forget - if the path/file contains spaces, enclose it with "double quotes"

That's essential. The problem are the spaces.

Gunther
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 17, 2013, 12:59:20 PM
longsnowname.com does not run.

longname8.exe don't run on my system either.

Bad command or filename.

Wait a minute, it's a feature.  :t

Andy
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 17, 2013, 01:03:36 PM
Quote from: dedndave on November 17, 2013, 11:59:56 AM
seems to work here, Andy
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Masm32\Asm16\16-Bit Templates => blahblahblah
Hello World !

C:\Masm32\Asm16\16-BIT~1 =>


don't forget - if the path/file contains spaces, enclose it with "double quotes"

I found out that if you are infected with Stuxnet, long filename 16 bit exes run correctly.  :t

Andy
Title: Re: what is the maximum length of masm 16 file Name
Post by: sinsi on November 17, 2013, 04:42:34 PM
Quote from: dedndave on November 17, 2013, 11:59:56 AM
seems to work here, Andy
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Masm32\Asm16\16-Bit Templates => blahblahblah
Hello World !

C:\Masm32\Asm16\16-BIT~1 =>


don't forget - if the path/file contains spaces, enclose it with "double quotes"
NTVDM shouldn't have a problem with a DOS program's long name but the program would (as would real DOS).
Dave, could you debug blahblahblah and look at the environment block? At the end should be the program name.
Wondering if it will be BLAHBL~1.EXE or blahblahblah.exe
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 17, 2013, 05:38:34 PM
My 16 bit programs are made using Tasm in case that makes a difference.

Later dudes,
                    Andy
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 17, 2013, 09:40:27 PM
lemme see....
SymDeb (or Debug) doesn't like the long file name on the command line - understandable
but, i can make the code dump the string
give me a few minutes.....
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 17, 2013, 09:57:41 PM
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Masm32\Asm16\16-Bit Templates => blahblahblah
C:\MASM32\ASM16\16-BIT~1\BLAHBL~1.COM

C:\Masm32\Asm16\16-BIT~1 =>

what i expected
notice the command prompt change   :P

        .MODEL  Tiny
        .386
        OPTION  CaseMap:None

;####################################################################################

        .CODE

;************************************************************************************

        ORG     100h

_main   PROC    NEAR

        mov     ds,ds:[2Ch]
        xor     si,si

loop00: lodsb
        or      al,al
        jnz     loop00

        lodsb
        or      al,al
        jnz     loop00

        mov     di,offset s$Msg
        add     si,2
        mov     dx,di
        jmp short loop02

loop01: stosb

loop02: lodsb
        or      al,al
        jnz     loop01

        mov     ax,0A0Dh
        stosw
        mov     al,24h
        stosb

        push    cs
        pop     ds
        mov     ah,9
        int     21h

        mov     ax,4C00h
        int     21h

_main   ENDP

;####################################################################################

s$Msg   db 1024 dup(0)

;####################################################################################

        END     _main

don't let Hutch see the code - it uses LODS/STOS   :lol:
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 19, 2013, 12:21:32 AM
No need to be scared.

Take some deep breaths.

Andy
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 19, 2013, 12:28:31 AM
As far as XP is concerned, long file name progs do NOT work, both Masm and Tasm produced.

And using Senor Dave's code.


C:\16_BIT>longmasm7.com
Bad Command or file name

C:\16_BIT>

Title: Re: what is the maximum length of masm 16 file Name
Post by: FORTRANS on November 19, 2013, 01:07:10 AM
Hi,

   Works here with Windows 98, Windows 2000, and Windows XP.

G:\WORK>COPY TEST44.COM BLABLABLABLA.COM
        1 file(s) copied.

G:\WORK>                BLABLABLABLA
G:\WORK\BLABLA~1.COM

G:\WORK>


Steve
Title: Re: what is the maximum length of masm 16 file Name
Post by: japheth on November 19, 2013, 01:19:08 AM

IIRC, the NTVDM supports LFNs, but XP's built-in DOS-Extender DOSX does not automatically translate those functions - which is a regression compared to Win9x.  So it might be that some old DOS-extended programs ( i.e. Tasm ), which were written in the Win9X era, may indeed have problems with LFNs on XP.
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 19, 2013, 02:02:28 AM
it's a .COM (tiny) program
shouldn't matter which assembler is used, as it does not have a header

adding ".com" to the end of the commandline probably isn't helping, though

it may be a matter of xp version
i have xp mce2005 sp3, which is a "professional" edition of xp
it may not be the same on xp home editions
Title: Re: what is the maximum length of masm 16 file Name
Post by: FORTRANS on November 19, 2013, 02:41:34 AM
Hi,

   I seem to recall from another thread that he has short filename
support turned off.  That could hurt things like Dave's program.

Regards,

Steve N.
Title: Re: what is the maximum length of masm 16 file Name
Post by: jj2007 on November 19, 2013, 02:42:57 AM
.model tiny
.code
   org 100h
start:
   mov ah, 09h   ; write string to STDOUT
   mov dx, 82h   ; get command line
   int 21h      ; show it... ;-)
   ret
end start


Commandline:
HelloWorldDOS.com And I told you that long filenames are fine on Win7-32....

Result:
And I told you that long filenames are fine on Win7-32.... ;)
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 19, 2013, 03:37:51 AM
Thanks Steve,

I temporarily re-enabled 8.3 name creation and the progs run.

http://support.microsoft.com/kb/121007

Why I turned it off.


The creation of 8.3 filenames and directories for all long filenames and directories on NTFS partitions may decrease directory enumeration performance.

It would be nice if I could actually test if performance did actually improve.

Andy
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 19, 2013, 03:45:05 AM
it would seem that the console is a 32-bit console window, until you run a 16-bit program under it
after that, it's a 16-bit console

so - i doubt you really want to optimize your system for 16-bit programs to run
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 19, 2013, 04:49:31 AM
Read this. Nothing to do with 16 bit programs.

http://support.microsoft.com/kb/121007
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 19, 2013, 05:08:42 AM
i read that
not sure how much difference it makes though

let me put it this way...
i haven't disabled 8.3 indexing on my machine, and i'm happy with the performance
not to say it couldn't be faster, of course

as for the per-instance console window
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Masm32\Asm16\16-Bit Templates => blahblahblah
Hello World !

C:\Masm32\Asm16\16-BIT~1 =>

something changed from before to after
it would seem that the console became "8.3 aware", only after a 16-bit program was executed
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 19, 2013, 05:12:58 AM
in the past, i have tried disabling indexing, altogether
performance improved, in some respects, but suffered in others
i no longer do that
Title: Re: what is the maximum length of masm 16 file Name
Post by: FORTRANS on November 19, 2013, 05:13:32 AM
Hi,

Quote from: dedndave on November 19, 2013, 03:45:05 AM
it would seem that the console is a 32-bit console window, until you run a 16-bit program under it
after that, it's a 16-bit console

   Yes.  As far as I can deduce, CMD.EXE runs COMMAND.COM to
support 16-bit programs.  Run a program that lets you shell out
to a command line and run "MEM /D | MORE".

Regards,

Steve N.
Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 19, 2013, 05:31:19 AM
shell - interesting notion, Steve
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Masm32\Asm16\16-Bit Templates => cmd /c blahblahblah
C:\MASM32\ASM16\16-BIT~1\BLAHBL~1.COM

C:\Masm32\Asm16\16-Bit Templates =>

so, if you want to run a 16-bit program without making it a 16-bit window   :P
if you run command.com, it converts to 16-bit, but....
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Masm32\Asm16\16-Bit Templates => cmd /c command
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\MASM32\ASM16\16-BIT~1 => ver

Microsoft Windows XP [Version 5.1.2600]

C:\MASM32\ASM16\16-BIT~1 => exit

C:\Masm32\Asm16\16-Bit Templates =>
Title: Re: what is the maximum length of masm 16 file Name
Post by: Magnum on November 19, 2013, 06:29:15 AM
cmd.exe gives a larger exe program size than command.com.

Title: Re: what is the maximum length of masm 16 file Name
Post by: dedndave on November 19, 2013, 09:29:18 AM
much larger, i suspect
but - command.com also requires NTVDM.dll