Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 697
  • Last Modified:

"com" vs "exe" files

What is the difference between .com and .exe files
0
r_bal
Asked:
r_bal
1 Solution
 
r_balAuthor Commented:
Adjusted points to 50
0
 
rovermCommented:
Com files are small, up to (a I recall correcly) 64kb, EXE can be very large.
U can set the LOAD address of a COM to a specific location, a EXE u cannot.
COM is faster !
0
 
rkumar121699Commented:
Both Com and Exe are executable files.

Whereas  a com file (Command File) has size restriction  compared to an Exe (Binary File ) file.

If you r having 2 file of same name with .Com and .Exe extensions

the sequence of execution (while giving the file name without Extension) as follows
1. .Com
2. .Exe

It means .. it will first search for a Com file and then for a Exe file if you are not mentioning the Extionsion.

Hope its clear.

Kumar

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
GlennDeanCommented:
This is from the "olden" days, but a .com executable has no relocatable segments where a .exe can have any number of them.  SO, for a .com the loader doesn't have to worry about where the stack segment is or the data segment or the code segment is (obviously this is Intel stuff).  I have never analyzed a .exe image that didn't have atleast 1 relocatable segment.
0
 
EdioCommented:
    I must agree with GlennDean that is old stuff, but i guess I am old as well.
      Them Com file style was made up to be compatibel with the previous operating system wide accepted, the CP/M(CP/M used to run on Apple II, Radio Shack TRS-80).
      The CP/M was based upon the microprocessor Z-80 from Zilog (it use to run at 4MHZ).
      The CP/M reserved 256 bytes of inicial program memory to interrupt vetors to the hardware and to the software (like DOS int21 for exemplo).
      So the COM file does the same and it always start at address 100H, and to be compatible code,data and stack segments are set to the same value at entering.
      The EXE file is the first native 16 bits 8086 file format, so you can have several segments.
      The first 512 bytes of an EXE file is the PSP(Programm Segment Prefix). which have several information about the program, including the entry point that may vary, you tell the compiler the name of the main procedure and it does the job.
      You may never heard about CP/M and this may be old stuff, but ug.. CP/M standards still lives inside WINDOWS2000.
0
 
GlennDeanCommented:
Edio:
   I didn't know the loader always loaded a .com at 100H, but thanxs for the info.
   The code/data/stack segment registers are all the same in a .com file.  When I use to write .com programs in assembly (along time ago "in a galaxy far far away") we would almost always mix data and code together!  It was quite common for the first instruction of the .com file to do a jump pass the data you needed.
   Like Edio mentioned, the PSP contains how many relocatable segments exists for a .com/.exe.  For a .com it must be 0.  
   Glenn
   
0
 
r_balAuthor Commented:
Thanx for the explanation.
0

Featured Post

[Video] Create a Disruption-Free Workspace

Open offices have their challenges. And Sometimes, it's even hard to work at work. It's time to reclaim your office and create a disruption-free workspace. With the MB 660, you can:

-Increase Concentration
-Improve well-being
-Boost Productivity

Tackle projects and never again get stuck behind a technical roadblock.
Join Now