home *** CD-ROM | disk | FTP | other *** search
- ; WARLIB.DOC Library routines by Warren A. Ring
-
- OpenDOSLibrary : This routine opens the DOS liibrary
-
- CloseDOSLibrary : This routine closes the DOS library
-
- OpenFile : This routine opens an already-existing file
-
- In: A0 => a string buffer containing the filename
- Out: A1 => the file handle (0 = file doesn't exist)
- Zero Flag = Clear if the file exists,
- Set if the file doesn't exist
-
- CreateFile : This routine creates a new file
-
- In: A0 => a string buffer containing the filename
- Out: A1 => the file handle (0 = file could not be created)
- Zero Flag = Clear if the file was created,
- Set if the file wasn't created
-
- Notes: This routine deletes any already-existing file of the same name.
- A create operation may fail because an already-existing file under
- the same name has its protection attribute set, or there is
- insufficient disk space to create the new file.
-
- DeleteFile : This routine deletes a file
-
- In: A0 => a string buffer containing the filename
- Out: D0 = the status (0 = file could not be deleted)
-
- Note: A delete operation may fail because the existing file has its
- protection attribute set.
-
- ReadFile : This routine reads a record from a file
-
- In: A0 => the file handle
- A1 => a string buffer to receive the data from the file
- Out: D0 = the number of characters read from the file
-
- Note: This routine overwrites any data already in the string buffer
-
- WriteFile : This routine writes a record to a file
-
- In: A0 => the file handle
- A1 => a string buffer containing the data for the file
- Out: D0 = the number of characters written to the file
- (-1 = write error, possibly disk full)
-
- SeekFile : This routine moves the position in a file at which the
- next read or write is to take place.
-
- In: A0 => the file handle
- D0 = the offset
- D1 = the mode:
- -1 = the offset is from the beginning of the file
- 0 = the offset is from the current position in the file
- 1 = the offset is from the end of file
- Out: D0 = the previous position
- (-1 = seek error)
-
- Notes: When a file is opened, the position at which the next read or write
- is to take place is the beginning of file. This position advances
- to the byte just beyond the end of each record as that record is
- read, so that if you read a file sequentially, you need never use the
- Seek system call.
-
- If you wish to append data to the end of a file, you seek with an
- offset of zero, and a mode of 1.
-
- CloseFile : This routine closes a previously-opened file.
-
- In: A0 => the file handle
-
- RenameFile : This routine renames a file
-
- In: A0 => a string buffer containing the current filename
- A1 => a string buffer containing the new filename
- Out: D0 = the status (0 = file could not be renamed)
-
- Notes: Directory names may be included in the filenames. Thus, this
- function can serve as a move function within a volume.
-
- A delete operation may fail because the destination file already
- exists, or because a named directory doesn't exist.
-
-
- DisplayCrlf : Outputs a carriage ret and line feed
-
- DisplaySpace : Outputs a space
-
- Left_ BASIC Fn: B$ = Left$(A$, I)
- <A1> <A0> D0
-
- In: A0 => source buffer
- A1 => dest buffer
- D0 = Number of bytes to copy
-
- Mid_ BASIC Fn: B$ = Mid$(A$, I, J)
- <A1> <A0> D0 D1
-
- In: A0 => source buffer
- A1 => dest buffer
- D0 = The position in A$ to start copying
- D1 = Number of bytes to copy
-
- Right_ BASIC Fn: B$ = Right$(A$, I)
- <A1> <A0> D0
-
- In: A0 => source buffer
- A1 => dest buffer
- D0 = The number of bytes in A$, from the right end,
- to start copying
-
- StrCpy_ BASIC Fn: B$ = A$
- <A1> <A0>
-
- In: A0 => source buffer (A$)
- A1 => dest buffer (B$)
-
- StrCat_ BASIC Fn: B$ = B$ + A$
-
- In: A0 => source buffer (A$)
- A1 => dest buffer (B$)
-
-
- StrCmp_ C fn: I = (A$==B$);
-
- This routine indicates whether or not A$ = B$
-
- In: A0 => source buffer (A$)
- A1 => dest buffer (B$)
- Out: <Zero flag> = Set if the strings are equal,
- = Clear if the strings are unequal
-
- StrLen_ BASIC Fn: I = LEN(A$)
-
- This routine indicates the current length of a string
-
- In: A0 => the buffer (A$)
- Out: D0 = the current useage of A$
-
-
- Scanw_ This routine scans a string for the next visible word
-
- In: ScanPointer => the next byte in the string to be
- scanned
- ScanCounter = the number of bytes in the string remaining
- to be scanned
- A0 => the dest buffer
- Out: ScanPointer, ScanCounter are updated
-
- Note: This routine skips over spaces, tabs, and other invisible characters
-
- Scana_ This routine scans a string for the next alphanumeric word
-
- In: ScanPointer => the next byte in the string to be
- scanned
- ScanCounter = the number of bytes in the string remaining
- to be scanned
- A0 => the dest buffer
- Out: ScanPointer, ScanCounter are updated
-
- Note: This routine skips over spaces, tabs, and invisible characters
- including non-alphanumeric characters
-
-
- Scanc_ This routine scans a string for the next character
-
- In: ScanPointer => the next byte in the string to be
- scanned
- ScanCounter = the number of bytes in the string remaining
- to be scanned
- A0 => the dest buffer
- Out: ScanPointer, ScanCounter are updated
-
- ItoA_ BASIC Fn: A$ = STR$(I)
- (A0) (D0)
-
- This routine converts a signed integer from binary to a
- decimal ASCII string.
-
-
- AtoI_ BASIC Fn: I = VAL(A$)
- (D0) (A0)
-
- This routine converts a decimal ASCII string to a signed
- binary integer.
-
-
- HAtoI_ BASIC Fn: I = HEX(A$)
- (D0) (A0)
-
- This routine converts a hex-ASCII string to a binary
- integer.
-
- Note: Conversion stops if a non-hex-ASCII character is encountered in
- the string.
-
-
- ItoHA8_ BASIC Fn: A$ = STR8HEX$(I)
- (A0) (D0)
-
- ItoHA4_ BASIC Fn: A$ = STR4HEX$(I)
- (A0) (D0)
-
- ItoHA2_ BASIC Fn: A$ = STR2HEX$(I)
- (A0) (D0)
-
-
- ItoHA1_ BASIC Fn: A$ = STR1HEX$(I)
- (A0) (D0)
-
-
- ItoHA_ BASIC Fn: A$ = STRHEX$(I)
- (A0) (D0)
-
- In: D1 = the number of hex-ASCII characters to convert
-
-
- IsHexASCII Is hex-ASCII routine
-
- This routine determines whether or not a character
- is a valid hex-ASCII character
-
- In: <D0.B> = the character
-
- Out: <Zero> = Clear if the character is a hex-ASCII
- character,
- = Set if the character is not a hex-
- ASCII character
-