home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / PP911.ZIP / HELLO386 < prev   
Text File  |  1990-05-07  |  1KB  |  47 lines

  1. POWER PROGRAMMING
  2. RAY DUNCAN
  3. Vol. 9, No. 11
  4.  
  5. HELLO386
  6.  
  7.  
  8.  
  9.         .386
  10.         assume  cs:FLAT,ds:FLAT,es:FLAT,ss:FLAT
  11.  
  12. _DATA   segment dword use32 public 'CODE'
  13. msg     db      0ah,'Hello World!',0    ; text to display
  14. _DATA   ends
  15.  
  16. _TEXT   segment dword use32 public 'CODE'
  17. wlen    equ     dword ptr [bp-12]  ; assign stack locations
  18. rc      equ     dword ptr [bp-8]   ; of local variables
  19. p       equ     dword ptr [bp-4]
  20.  
  21. _main   proc    near
  22.         push    ebp             ; set up stack frame
  23.  
  24.         mov     ebp,esp
  25.         sub     esp,12          ; allocate local vars
  26.         mov     p,offset msg    ; initialize variable p
  27.                                 ; set up Dos32Write call
  28.         lea     eax,wlen        ; push address of wlen
  29.         push    eax
  30.         push    offset msg      ; find length of text
  31.         call    _strlen
  32.         lea     esp,dword ptr [ebp-16]  ; clear stack
  33.         push    eax             ; push length of text
  34.         push    p               ; push address of text
  35.         push    1               ; push stdout handle
  36.         call    Dos32Write      ; transfer to OS/2
  37.         lea     esp,wlen        ; clear args from stack
  38.         mov     rc,eax          ; save error/success code
  39.         leave                   ; discard stack frame
  40.         ret                     ; return to caller
  41. _main   endp
  42.  
  43. _TEXT   ends
  44.  
  45.  
  46.  
  47.