home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / 9 / fig9_2.asm next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.1 KB  |  40 lines

  1.         .
  2.         .
  3.         .
  4. _TEXT   segment para public 'CODE'
  5.  
  6.         org     100h
  7.  
  8.         assume  cs:_TEXT,ds:_TEXT,es:_TEXT,ss:_TEXT
  9.  
  10. main    proc    near            ; entry point from MS-DOS
  11.                                 ; CS = DS = ES = SS = PSP
  12.  
  13.                                 ; first move our stack
  14.         mov     sp,offset stk   ; to a safe place...
  15.  
  16.                                 ; now release extra memory...
  17.         mov     bx,offset stk   ; calculate paragraphs to keep
  18.         mov     cl,4            ; (divide offset of end of
  19.         shr     bx,cl           ; program by 16 and round up)
  20.         inc     bx
  21.         mov     ah,4ah          ; Fxn 4AH = resize mem block
  22.         int     21h             ; transfer to MS-DOS
  23.         jc      error           ; jump if resize failed
  24.         .
  25.         .                       ; otherwise go on with work...
  26.         .
  27.  
  28. main    endp
  29.  
  30.         .
  31.         .
  32.         .
  33.  
  34.         dw      64 dup (?)
  35. stk     equ     $               ; base of new stack area
  36.  
  37. _TEXT   ends
  38.  
  39.         end     main            ; defines program entry point
  40.