home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / dosexec.zip / OVERLAY.ASM < prev    next >
Assembly Source File  |  1989-06-07  |  1KB  |  56 lines

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