home *** CD-ROM | disk | FTP | other *** search
- include compiler.inc
- ttl FSEEK, 1.05, 10/20/86, jwk
-
- ;lseek for stream i/o- long lseek(handle, offsetL, base);
- ; returns file position, or -1L in case of error
- ; clears any ungetc() char, CR flag, and EOF flag
-
- dseg
- exterr
- cseg
-
- xtfs <lseek,$strhand>
-
- procdef fseek, <<stream, ptr>, <offlo, word>, <offhi, word>, <base, byte>>
- pushreg
- pushds
- callit $strhand <<stream,ptr>>
- cmp ax,-1
- je ex ; bad stream pointer
- callit lseek,<<base,byte>,<offhi,word>,<offlo,word>,<ax,reg>>
- ldptr si,stream
- mov word ptr [si], -1 ; blank out UGC char if any
- and byte ptr 2[si], 0f7h ; clear EOF bit
- mov byte ptr 3[si], 0 ; and CRFLG
- inc dx
- jnz ex
- saverr ; save error code
- or byte ptr 2[si],10h ; set error flag bit
- ex: dec dx
- pret
- pend fseek
-
- finish
-