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

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;          Function 21H: Random File Read, FCB-based         ;
  4.         ;                                                            ;
  5.         ;          int FCB_rread(oXFCB,recnum)                       ;
  6.         ;              char *oXFCB;                                  ;
  7.         ;              long recnum;                                  ;
  8.         ;                                                            ;
  9.         ;          Returns 0 if record read OK, otherwise            ;
  10.         ;          returns error code 1, 2, or 3.                    ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   FCB_rread,PUBLIC,ds
  15. parmDP  poXFCB
  16. parmD   recnum
  17. cBegin
  18.         loadDP  ds,dx,poXFCB    ; Pointer to opened extended FCB.
  19.         mov     bx,dx           ; BX points at FCB, too.
  20.         mov     ax,word ptr (recnum)    ; Get low 16 bits of record
  21.         mov     [bx+28h],ax             ; number and store in FCB.
  22.         mov     ax,word ptr (recnum+2)  ; Get high 16 bits of record
  23.         mov     [bx+2ah],ax             ; number and store in FCB.
  24.         mov     ah,21h          ; Ask MS-DOS to read recnum'th
  25.                                 ; record, placing it at DTA.
  26.         int     21h
  27.         cbw                     ; Clear high byte of return value.
  28. cEnd
  29.