flat assembler
Message board for the users of flat assembler.

Index > DOS > Are there advantages of using exe insted of com executables?

Author
Thread Post new topic Reply to topic
rCX



Joined: 29 Jul 2007
Posts: 172
Location: Maryland, USA
rCX 24 May 2009, 20:10
Are there advantages of using exe insted of com executables?
Post 24 May 2009, 20:10
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20661
Location: In your JS exploiting you and your system
revolution 25 May 2009, 05:59
rCX wrote:
Are there advantages of using exe insted of com executables?
Yes.

A few to get you started: code+data>64kB, arbitrary entry point, pre-allocated segments, ...
Post 25 May 2009, 05:59
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 794
Location: Adelaide
sinsi 25 May 2009, 06:05
And no.
Post 25 May 2009, 06:05
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8428
Location: Kraków, Poland
Tomasz Grysztar 25 May 2009, 12:27
The non-MZ .com executable file cannot be larger than 64K, so if you need to have more code there, you are forced to use the MZ format. Though you can still disguise MZ with a .com extension - it's not the file extension that determines the type of executable.

Also, MZ has a nice feature of relocations, which non-MZ lacks.
Post 25 May 2009, 12:27
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20661
Location: In your JS exploiting you and your system
revolution 25 May 2009, 12:46
Plus the things I mentioned in my posting above. But you have to reveal the hidden to see what I wrote.
Post 25 May 2009, 12:46
View user's profile Send private message Visit poster's website Reply with quote
rCX



Joined: 29 Jul 2007
Posts: 172
Location: Maryland, USA
rCX 25 May 2009, 15:19
revolution wrote:
A few to get you started: code+data>64kB, arbitrary entry point, pre-allocated segments, ...

Tomasz Grysztar wrote:
The non-MZ .com executable file cannot be larger than 64K, so if you need to have more code there, you are forced to use the MZ format.


So for programs smaller than 64Kb com files are okay...
Post 25 May 2009, 15:19
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8428
Location: Kraków, Poland
Tomasz Grysztar 25 May 2009, 15:31
revolution wrote:
pre-allocated segments

Well, the .com program has the memory segments following the program segment pre-allocated aswell.
Post 25 May 2009, 15:31
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20661
Location: In your JS exploiting you and your system
revolution 25 May 2009, 15:45
pre-allocated segment[ register]s? I don't remember if DOS does this or not.


Last edited by revolution on 25 May 2009, 15:47; edited 1 time in total
Post 25 May 2009, 15:45
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20661
Location: In your JS exploiting you and your system
revolution 25 May 2009, 15:47
rCX wrote:
So for programs smaller than 64Kb com files are okay...
Sure, for DOS no problem.
Post 25 May 2009, 15:47
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 25 May 2009, 23:27
Can't you just load an external .bin file with more code? Wink
Post 25 May 2009, 23:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20661
Location: In your JS exploiting you and your system
revolution 26 May 2009, 02:02
Yes, it is known as runtime linking. Often they come as DLL files. But that is no longer a single .exe or .com file anymore.
Post 26 May 2009, 02:02
View user's profile Send private message Visit poster's website Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 27 May 2009, 05:30
I use FASM to create "memory image" executables up to about 512K in size (DOS memory limit). These are (or could be) DOS .COM programs with CS=DS=ES=SS, IP=0100h, SP=0FFFEh etc.

They CAN be run in DOS but not directly from the command prompt (only because DOS checks for >64K size).

Instead, they can be loaded into DEBUG or other compatible debugger and executed with the "g" command.

_________________
FAMOS - the first memory operating system
Post 27 May 2009, 05:30
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 30 May 2009, 12:17
rCX wrote:
Are there advantages of using exe insted of com executables?


YES.

* For MZ EXE you can control stack location and size, for COM it's just SS=CS and SP=$FFFE

* For MZ EXE you can control memory hogging, COM always hogs the complete biggest fragment

* MZ has a Sigi and header, safer to recognize (but DOS is stupid and loads broken MZ's and even EXE's having no MZ at all - as COM)

* You can include Win32 stuff into a MZ EXE, OTOH not into a COM

* MZ can be > 64 KiB (but has fixups then Sad )

revolution wrote:










Nothing as usual ... or is it hidden again Shocked ?

See: http://board.flatassembler.net/topic.php?t=9834
Post 30 May 2009, 12:17
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.