[.COM.EXE] The Types of Assembly Programs and its differences - COM vs EXE

Ashutosh Kumar
By -
0

Difference b/w Com vs Exe application type

 

Hi, Everyone 


In this article I will try to explain to type of Assembly Programs. And I will show difference between COM vs EXE programs.


COM Programs


COM program having binary image of a machine language. It is loaded in memory in lowest available segment address. The code of COM program starts from offset 100h, Because First 1K location are occupied for IVT (Interrupt Vector Table).

COM Programs keeps all the code, data and stack in same segment. And the memory is divided in segment of 64KB. The maximum offset in COM can be of 2^16 (65,675). this is why size of COM program is limited to 64KB which include all the CODE, DATA and STACK in same segment. 

This program file stored in desk with .com extension. A COM Program file need less disk space than EXE. At run-time the COM program place the stack segment at the end the segment.


CSEG SEGEMENT
    ASSUME CS:CSEG, DS: CSEG, SS:CSEG
    ORG     100h
START:          MOV AX, CSEG
                MOV DS, AX
                MOV AL, NUM1
                ADD AL, NUM2
                MOV RESULT, AL
                RCL AL, 01
                AND AL, 00000001B
                MOV CARRY, AL
                MOV AX, 4C00h
                INT 21h


                NUM1 DB    15h
                NUM2  DB     20h
                RESULT DB   ?
                CARRY        ?
CSEG ENDS
END START



EXE Programs


An EXE program is stored in disk with .exe extension. Generally EXE programme is longer than COM programs. Each of exe program having an EXE header of 256 bytes followed by a load module contain the program itself.

EXE header contains meta information for Operating System of calculate the address of segments and components.

Advantage of Writing exe instead com programs

Exe programs are better suited for development.
Exe Programs assembler can convert easily into subroutines for High Level Language(HLL).

Multitasking operating system (OS) can be used with full efficiency with EXE programs Because programs shares computer memory and resource.


DATA SEGEMENT
  NUM1 DB    15h
  NUM2  DB     20h
  RESULT DB   ?
  CARRY        ?
DATA ENDS
CODE SEGEMNT
    ASSUME CS:CODE, DS: DATA
START:   MOV AX, DATA
                MOV DS, AX
                MOV AL, NUM1
                ADD AL, NUM2
                MOV RESULT, AL
                RCL AL, 01
                AND AL, 00000001B
                MOV CARRY, AL
                MOV AX, 4C00h
                INT 21h
CODE ENDS
END START


Difference b/w COM and EXE Programs.


COM Program having all segment as part of one segment. But in EXE having separate files.

Post a Comment

0Comments

✍️ Only article/post centric comments are allowed.
❌**No Spam**
❌**Advertisement**
❌**No abuse**
Rules strictly applied ✅

Post a Comment (0)