home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 April
/
Chip_1997-04_cd.bin
/
prezent
/
cb
/
data.z
/
FILEPOS.ASM
< prev
next >
Wrap
Assembly Source File
|
1997-01-16
|
1KB
|
67 lines
; *******************************************************
; * *
; * Delphi Runtime Library *
; * *
; * Copyright (c) 1996 Borland International *
; * *
; *******************************************************
INCLUDE SE.ASM
INCLUDE FILEIO.ASM
.386
.MODEL FLAT
EXTRN SetFilePointer:NEAR, GetLastError:NEAR
EXTRN SetInOutRes:NEAR, InOutError:NEAR
PUBLIC _FilePos
.CODE
; PROCEDURE _FilePos( f: File );
_FilePos PROC
; -> EAX Pointer to file variable
PUSH EBX
MOV EBX,EAX
MOV EDX,[EBX].Mode ; check whether file is open
SUB EDX,fmInput
CMP EDX,fmInOut-fmInput
JA @@fileNotOpen
PUSH FILE_CURRENT
PUSH 0
PUSH 0
PUSH [EBX].Handle
CALL SetFilePointer ; get current position
CMP EAX,-1
JZ @@error
XOR EDX,EDX
DIV [EBX].RecSize ; position is in records
@@exit:
POP EBX
RET
@@error:
CALL InOutError
OR EAX,-1
JMP @@exit
@@fileNotOpen:
MOV EAX,103
CALL SetInOutRes
OR EAX,-1
JMP @@exit
_FilePos ENDP
END