Category : Assembly Language Source Code
Archive   : C--C0200.ZIP
Filename : FILE.H--

 
Output of file : FILE.H-- contained in archive : C--C0200.ZIP

/*
SPHINX Programming (C) 1993.
NAME: FILE.H--
DESCRIPTION: File related constant definitions and procedures.
LAST MODIFIED: 26 Dec 1993
PROCEDURES DEFINED IN THIS FILE:
: word appendfile(filename,bufsegment,bufoffset,bytes)
: word close(filehandle)
: word create(filename,attribute)
: word open(filename,byte mode)
: word read(filehandle,bufferoffset,bytes)
: word readfar(filehandle,bufferseg,bufferoffset,bytes)
: word readfile(filename,bufseg,bufoff,bytes)
: word write(filehandle,bufferoffset,bytes)
: word writefar(filehandle,bufferseg,bufferoffset,bytes)
: word writefile(filename,bufseg,bufoff,bytes)
*/


/*** file access constansts for use with open() and FOPEN() ***/

enum { F_READ, F_WRITE, F_READWRITE };


/*** file attribute constants for use with create() and FCREATE() ***/

?define FA_NORMAL 0x00
?define FA_READONLY 0x01
?define FA_HIDDEN 0x02
?define FA_SYSTEM 0x04
?define FA_VOLUME 0x08
?define FA_DIRECTORY 0x10
?define FA_ARCHIVE 0x20


/*** standard input, output, error, auxilary and printer file handles ***/

?define STDIN 0
?define STDOUT 1
?define STDERR 2
?define STDAUX 3
?define STRPRN 4


/****** procedure definitions ******/


: word open (word filename; byte mode)
{
?DOSrequired 0x200
AL = mode;
DX = filename;
AH = 0x3D;
$INT 0x21
IF( CARRYFLAG )
AX = 0;
}


: word create (word filename, attribute)
{
?DOSrequired 0x200
CX = attribute;
DX = filename;
AH = 0x3C;
$INT 0x21
IF( CARRYFLAG )
AX = 0;
}


: word close (word filehandle)
{
?DOSrequired 0x200
BX = filehandle;
AH = 0x3E;
$INT 0x21
IF( NOTCARRYFLAG )
AX = 0;
}


: word readfile (word filename,bufseg,bufoff,bytes)
inline
{?DOSrequired 0x0200
$ DB 0x55,0x89,0xE5,0x36,0x8B,0x56,0xA,0xB8,0x0,0x3D,
0xCD,0x21,0x73,0x6,0x31,0xC0,0x5D,0xC2,0x8,0x0,
0x89,0xC3,0x36,0x8B,0x46,0x8,0x1E,0x8E,0xD8,0x36,
0x8B,0x56,0x6,0x36,0x8B,0x4E,0x4,0xB4,0x3F,0xCD,
0x21,0x73,0x2,0x31,0xC0,0x89,0xC2,0xB4,0x3E,0xCD,
0x21,0x89,0xD0,0x1F,0x5D,0xC2,0x8,0x0
}


: word appendfile (word filename,bufsegment,bufoffset,bytes)
inline
{?DOSrequired 0x0200
$ DB 0x55,0x8B,0xEC,0x36,0x8B,0x56,0xA,0xB8,0x1,0x3D,
0xCD,0x21,0x73,0xE,0xB4,0x3C,0x33,0xC9,0xCD,0x21,
0x73,0x6,0x33,0xC0,0x5D,0xC2,0x8,0x0,0x89,0xC3,
0xB8,0x2,0x42,0x33,0xC9,0x33,0xD2,0xCD,0x21,0x72,
0x15,0x36,0x8B,0x46,0x8,0x1E,0x8E,0xD8,0x36,0x8B,
0x56,0x6,0x36,0x8B,0x4E,0x4,0xB4,0x40,0xCD,0x21,
0x73,0x2,0x33,0xC0,0x8B,0xD0,0xB4,0x3E,0xCD,0x21,
0x89,0xD0,0x1F,0x5D,0xC2,0x8,0x0
}


: word writefile (word filename,bufseg,bufoff,bytes)
inline
{?DOSrequired 0x0200
$ DB 0x55,0x89,0xE5,0x36,0x8B,0x56,0xA,0xB4,0x3C,0x31,
0xC9,0xCD,0x21,0x73,0x6,0x31,0xC0,0x5D,0xC2,0x8,
0x0,0x89,0xC3,0x36,0x8B,0x46,0x8,0x1E,0x8E,0xD8,
0x36,0x8B,0x56,0x6,0x36,0x8B,0x4E,0x4,0xB4,0x40,
0xCD,0x21,0x73,0x2,0x31,0xC0,0x89,0xC2,0xB4,0x3E,
0xCD,0x21,0x89,0xD0,0x1F,0x5D,0xC2,0x8,0x0
}


: word read (word filehandle,bufferoffset,bytes)
inline
{?DOSrequired 0x0200
$ DB 0x5F,0x59,0x5A,0x5B,0xB4,0x3F,0xCD,0x21,0x73,0x2,
0x31,0xC0,0xFF,0xE7
}


: word readfar (word filehandle,bufferseg,bufferoffset,bytes)
inline
{?DOSrequired 0x0200
$ DB 0x5F,0x59,0x5A,0x8C,0xDE,0x1F,0x5B,0xB4,0x3F,0xCD,
0x21,0x73,0x2,0x31,0xC0,0x8E,0xDE,0xFF,0xE7
}


: word write (word filehandle,bufferoffset,bytes)
inline
{?DOSrequired 0x0200
$DB 0x5F,0x59,0x5A,0x5B,0xB4,0x40,0xCD,0x21,0x73,0x2,
0x31,0xC0,0xFF,0xE7
}


: word writefar (word filehandle,bufferseg,bufferoffset,bytes)
inline
{?DOSrequired 0x0200
$DB 0x5F,0x59,0x5A,0x8C,0xDE,0x1F,0x5B,0xB4,0x40,0xCD,
0x21,0x73,0x2,0x31,0xC0,0x8E,0xDE,0xFF,0xE7
}


/* end of FILE.H-- */