;**********************************************
; Example of a .COM file program--compgm.asm
;**********************************************
title   com file example program
        page    60,132
comseg  segment             ;this is the common segment
        assume cs:comseg,ds:comseg
        org    100h         ;start after PSP
begin:  jmp    main         ;jump over data
;----------------------------------------------
num1    dw     1234h
num2    dw     0abcdh
sum     dw     ?
;----------------------------------------------
main    proc   near
        mov    ax,num1      ;note, no bookkeeping!
        add    ax,num2
        mov    sum,ax
        ret
main    endp
comseg  ends
        end    begin

-------------------- CUT HERE -----------------------

Assemble with:

C:\> ml /AT compgm.asm
-----------------------------------------------------

Debug Session:

C:\> debug compgm.com

-u100
3B71:0100 EB06          JMP     0108
3B71:0102 3412          XOR     AL,12
3B71:0104 CDAB          INT     AB
3B71:0106 0000          ADD     [BX+SI],AL
3B71:0108 A10201        MOV     AX,[0102]
3B71:010B 03060401      ADD     AX,[0104]
3B71:010F A30601        MOV     [0106],AX
3B71:0112 C3            RET

-d102,107
3B71:0100        34 12 CD AB 00 00

-g=100

Program terminated normally

-d102,107
3B71:0100        34 12 CD AB 01 BE