home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / 10 / overlay.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.6 KB  |  52 lines

  1.          name      overlay
  2.          title     'OVERLAY segment'
  3. ;
  4. ; OVERLAY.EXE --- a simple overlay segment 
  5. ; loaded by ROOT.EXE to demonstrate use of
  6. ; the MS-DOS EXEC call Subfunction 03H.
  7. ; The overlay does not contain a STACK segment
  8. ; because it uses the ROOT segment's stack.
  9. ;
  10. ; Ray Duncan, June 1987
  11. ;
  12.  
  13. stdin   equ     0                       ; standard input
  14. stdout  equ     1                       ; standard output
  15. stderr  equ     2                       ; standard error
  16.  
  17. cr      equ     0dh                     ; ASCII carriage return
  18. lf      equ     0ah                     ; ASCII linefeed
  19.  
  20.  
  21. _TEXT   segment byte public 'CODE'      ; executable code segment
  22.  
  23.         assume  cs:_TEXT,ds:_DATA
  24. ovlay   proc    far                     ; entry point from root segment
  25.  
  26.         mov     ax,_DATA                ; set DS = local data segment
  27.         mov     ds,ax
  28.  
  29.                                         ; display overlay message ...
  30.         mov     dx,offset msg           ; DS:DX = address of message
  31.         mov     cx,msg_len              ; CX = length of message
  32.         mov     bx,stdout               ; BX = standard output handle 
  33.         mov     ah,40h                  ; AH = fxn 40H, write file/device
  34.         int     21h                     ; transfer to MS-DOS
  35.  
  36.         ret                             ; return to root segment
  37.  
  38. ovlay   endp                            ; end of ovlay procedure
  39.  
  40. _TEXT   ends
  41.  
  42.  
  43. _DATA   segment para public 'DATA'      ; static & variable data segment
  44.  
  45. msg     db      cr,lf,'Overlay executing!',cr,lf
  46. msg_len equ     $-msg
  47.  
  48. _DATA   ends
  49.  
  50.         end
  51.