qa.hlp (Table of Contents; Topic list)
HELLO.ASM
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* HELLO.ASM - Illustrates simplified segment directives.
;*
;* Shows:  Directives - TITLE     .MODEL    DOSSEG      .STACK
;*                      .DATA     .CODE     .STARTUP    OFFSET
;*                      .EXIT     END
;*         DOS Functions - 09h (Display String)
;*
;* See HELLOF.ASM for a full-segment .EXE file version or HELLOC.ASM
;* for a full-segment .COM file version.
 
        TITLE   HELLO
        .MODEL  small, c                ; Small model (could be any model)
        DOSSEG                          ; Force DOS segment order
 
        .STACK  100h                    ; 256-byte stack
 
        .DATA                           ; Data segment
msg     DB      "Hello, world.", 13, 10, "$"
 
        .CODE                           ; Code segment
        .STARTUP                        ; Initialize data segment and
                                        ;   set SS = DS
        mov     ah, 9h                  ; Request DOS Function 9
        mov     dx, OFFSET msg          ; Load DX with offset of string
                                        ;   (segment already in DS)
        int     21h                     ; Display String
 
        .EXIT   0                       ; Exit  with return code 0
 
        END
                                    -♦-