home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / progjour / 1991 / 06 / alib / in_fsize.asm < prev    next >
Assembly Source File  |  1991-06-25  |  588b  |  42 lines

  1.     include    asm.inc
  2.  
  3.     public    input_file_size
  4.  
  5.     .code
  6.     extn    ms_dos_strerror
  7.  
  8.  
  9. ;;    input file size
  10. ;
  11. ;    entry    BX    file handle
  12. ;    exit    DX AX    size
  13. ;
  14. input_file_size proc
  15.     pushm    cx,di,si
  16.     mov    ax,4201h        ; get current position
  17.     movx    cx,0
  18.     movx    dx,0
  19.     call    ms_dos_strerror
  20.     jc    ifs1
  21.     mov    si,dx            ;  into SI DI
  22.     mov    di,ax
  23.  
  24.     mov    ax,4202h        ; move to end of file
  25.     movx    dx,0
  26.     call    ms_dos_strerror
  27.     jc    ifs1
  28.  
  29.     pushm    ax,dx
  30.     mov    ax,4200h        ; restore file position
  31.     mov    cx,si
  32.     mov    dx,di
  33.     call    ms_dos_strerror
  34.     popm    dx,ax
  35.  
  36. ifs1:    popm    si,di,cx
  37.     ret
  38. input_file_size endp
  39.  
  40.  
  41.     end
  42.