CSEG SEGMENT
ASSUME CS:CSEG, DS:CSEG, SS:CSEG
ORG 100h
START:MOV AX, CSEG; Initialise data segment
MOV DS, AX; register using AX
MOV AL, NUM1; Take the first number in AL
ADD AL, NUM2; Add the 2nd number to it
MOV RESULT, AL; Store the result in location RESULT
RCL AL, 01; rotate carry into LSB
AND AL, 00000001B; Mask out all but LSB
MOV CARRY, AL; Store the carry result
MOV AX,4C00h
INT 21h
NUM1 DB 15h; First number stored here
NUM2 DB 20h; Second number stored here
RESULT DB ? ; Put sum here
CARRY DB ? ; Put any carry here
CSEG ENDS
END START
These programs are stored on a disk with an extension .com. A COM program needs less space on disk instead of equivalent EXE program. At run-time COM program places stack automatically at the end of segment so they use at least one complete segment.