home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
lan
/
nxcopy
/
utvread.mod
< prev
next >
Wrap
Text File
|
1987-03-17
|
2KB
|
62 lines
Module Var_Read;
Const
{$I UTCONSTS.DEF}
Type
{$I UTTYPES.DEF}
Reg = RECORD
A : Register;
B : Register;
C : Register;
D : Register;
SI : Word;
DI : Word;
BP : Word;
DS : Word;
ES : Word;
Flags : Word;
End; { Record declaration }
Var
{$I UTEVARS.DEF}
{$I UTPROCS.DEF}
{ Type conversion utilities for address arithmetic }
EXTERNAL Procedure Intr( Intr_No : Integer; VAR Regs : Reg );
EXTERNAL Function Segm( Variable : StringPtr ) : Integer;
EXTERNAL Function Offs( Variable : StringPtr ) : Integer;
{==============================================================================}
Procedure DOS_VRead( Handle : Integer; Buffer : StringPtr;
VAR Bytes_Requested : Integer;
VAR Error : Integer );
Var
R : Reg;
Begin
R.A.H := $3F; { function for READ }
R.B.X := Handle;
R.C.X := Bytes_Requested;
R.D.X := Offs( Buffer ); { where to transfer data - offset }
R.DS := Segm( Buffer ); { segment }
Intr( $21, R );
If ( ( R.Flags & 1 ) = 1 ) Then { test carry flag }
Begin
Error := Short( Long( R.A.X ) ); { if carry set, error returned in AX }
Bytes_Requested := 0;
End
Else
Begin
Error := 0;
{ Also, actual "number of bytes read" returned in AX if no error }
Bytes_Requested := Short( Long( R.A.X ) );
End
End;
{==============================================================================}
MODEND.