qa.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
HELLOM.ASM
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* HELLOM.ASM illustrates multiple-modules and memory model independent
;* techniques. To create the program, paste this module and PUTSTR.ASM
;* (get help on PUTSTR.ASM to open it) into separate program files. In
;* the environment, you must also create a program list for the program
;* and define a model in the Defines field of the Assembler Flags dialog
;* box. For example, use "model=large". Alternately, you could assemble
;* outside the environment with the following command line:
;*      qcl /Dmodel=large hellom.asm putstr.asm
;*
;* Shows:   Instruction - call
;*          Directives - EXTRN
;*          Equates - @DataSize     @CodeSize
;*          Operators - %
 
; Model is symbol passed from command line or environment. Note that the %
; operator is required to receive external constant symbols.
%       .MODEL  model, c
 
        DOSSEG
        .STACK  100h
        .DATA
msg     DB      "Hello, world.", 13, 10, 0      ; Null-terminated string
 
        .CODE
        .STARTUP                        ; Initialize data and stack segments
 
; Tell assembler that PutStr is elsewhere (in another module).
 
        EXTRN   PutStr:PROC             ; PROC evalutes to NEAR or FAR
                                        ;   code depending on model
        IF      @DataSize               ; If data is far (compact, large,
        push    ds                      ;   or huge), push data segment
        ENDIF
        mov     ax, OFFSET msg          ; Always push the offset
        push    ax
 
        call    PutStr                  ; Call external procedure
 
        .EXIT                           ; Exit program
 
        END
                                    -♦-