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

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;         Function 4AH: Resize Memory Block                  ;
  4.         ;                                                            ;
  5.         ;         int modify_block(nparas,blockseg,pmaxparas)        ;
  6.         ;             int nparas,blockseg,*pmaxparas;                ;
  7.         ;                                                            ;
  8.         ;         Returns 0 if modification was a success,           ;
  9.         ;         otherwise returns error code with pmaxparas        ;
  10.         ;         set to max number of paragraphs available.         ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   modify_block,PUBLIC,ds
  15. parmW   nparas
  16. parmW   blockseg
  17. parmDP  pmaxparas
  18. cBegin
  19.         mov     es,blockseg     ; Get block address.
  20.         mov     bx,nparas       ; Get nparas.
  21.         mov     ah,4ah          ; Set function code.
  22.         int     21h             ; Ask MS-DOS to change block size.
  23.         mov     cx,bx           ; Save BX.
  24.         loadDP  ds,bx,pmaxparas
  25.         mov     [bx],cx         ; Set pmaxparas, assuming failure.
  26.         jb      mb_exit         ; Branch if size change error.
  27.         xor     ax,ax           ; Return 0 if successful.
  28. mb_exit:
  29. cEnd
  30.