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

  1.         .
  2.         .
  3.         .
  4.  
  5. _TEXT   segment word public 'CODE'      ; executable code segment
  6.  
  7.         assume  cs:_TEXT,ds:_DATA,ss:_STACK
  8.  
  9. main    proc    far             ; entry point from MS-DOS
  10.                                 ; CS = _TEXT segment,
  11.                                 ; DS = ES = PSP
  12.  
  13.         mov     ax,_DATA        ; set DS = our data segment
  14.         mov     ds,ax
  15.  
  16.                                 ; give back extra memory...
  17.         mov     ax,es           ; let AX = segment of PSP base
  18.         mov     bx,ss           ; and BX = segment of stack base
  19.         sub     bx,ax           ; reserve seg stack - seg psp
  20.         add     bx,stksize/16   ; plus paragraphs of stack
  21.         inc     bx              ; round up
  22.         mov     ah,4ah          ; Fxn 4AH = resize memory block
  23.         int     21h
  24.         jc      error
  25.  
  26. main    endp
  27.  
  28. _TEXT   ends
  29.  
  30.  
  31. _DATA   segment word public 'DATA'      ; static & variable data
  32.  
  33.         .
  34.         .
  35.         .
  36.  
  37. _DATA   ends
  38.  
  39.  
  40. STACK   segment para stack 'STACK'
  41.  
  42.         db      stksize dup (?)
  43.  
  44. STACK   ends
  45.  
  46.         end     main            ; defines program entry point
  47.