{ SPX Library Version 2.0 Copyright 1993 Scott D. Ramsay } SPX_DOS is a generic file and memory handling unit. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function OpenDos(FileName:string):word; Open a file for reading. FILENAME: File to read Returns a handle to the open file or 0 if an error ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure ReadDos(Handle:word;Buffer:pointer;var size:word;Var Error:byte); Read data from a file opened from OpenDos HANDLE: handle to the open file BUFFER: pointer to the buffer to store the data SIZE: number of bytes to read ERROR: 0 no error, or dos error code ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure SeekDos(Handle:word;position:longint); Change the file position of the file. HANDLE: handle to the open file POSITION: the absolute positon of the file (in bytes) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function PosDos(Handle:word):longint; Returns the current position of the file (in bytes). HANDLE: handle to the open file. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure CloseDos(var Handle:word); Closes an open file. HANDLE: handle to the file to close ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function malloc(size:word):pointer; Allocates memory up to 64k bytes. Uses the TP heap space. Does memory checking. SIZE: The number of bytes to allocate Returns a pointer to the memory block or NIL if could not allocate memory. You can use freely with GetMem/FreeMem. Do not use with MARK/RELEASE. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ procedure free(var p:pointer); Deallocte a memory block allocated from malloc. P: Pointer to the memory block to be freed. Returns P := NIL You can use freely with GetMem/FreeMem. Do not use with MARK/RELEASE. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ function GetPtr(p:pointer;offset:longint):pointer; Creates a new pointer at P+offset. Adjusts for segment boundries. Returns the new pointer location. Note: offset MUST be positive or zero. P: pointer to adjust OFFSET: offset for the pointer (in bytes) EXAMPLE: var p : pointer; p := GetPtr(SomePointer,88000); { p points to 88000 bytes past SomePointer } ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ