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

  1. fhandle dw      ?               ; handle from previous open
  2. buff    db      512 dup (?)     ; buffer for data from file
  3.  
  4.         .
  5.         .
  6.         .
  7.                                 ; position the file pointer...
  8.         mov     cx,0            ; CX = high part of file offset
  9.         mov     dx,32768        ; DX = low part of file offset
  10.         mov     bx,fhandle      ; BX = handle for file
  11.         mov     al,0            ; AL = positioning mode
  12.         mov     ah,42h          ; Function 42H = position
  13.         int     21h             ; transfer to MS-DOS
  14.         jc      error           ; jump if function call failed
  15.  
  16.                                 ; now read 512 bytes from file
  17.         mov     dx,offset buff  ; DS:DX = address of buffer
  18.         mov     cx,512          ; CX = length of 512 bytes
  19.         mov     bx,fhandle      ; BX = handle for file
  20.         mov     ah,3fh          ; Function 3FH = read
  21.         int     21h             ; transfer to MS-DOS
  22.         jc      error           ; jump if read failed
  23.         cmp     ax,512          ; was 512 bytes read?
  24.         jne     error           ; jump if partial rec. or EOF
  25.         .
  26.         .
  27.         .
  28.