IRVINE.LIB Link Library

Unfortunately, the documentation for the book's link library (IRVINE.LIB) in Appendix E is not as good as it should be. The following documentation was taken directly from the libarary source code, and it does a better job of explaining how to call the procedures.

Close_file
Close a file handle. Input: BX = file handle.

Clrscr
Clears the entire screen and locates the cursor at row 0, column 0. No parameters. Works only on
video page 0, in text mode.

Create_file
Create a new file using a given filename. Input parameter: DX = offset of filename. Output: AX = file handle

Crlf
Writes a carriage return / linefeed sequence (0Dh,0Ah) to standard output.

Delay_seconds
Causes the program to pause for n seconds. Input parameter: EAX contains the number of seconds.

DOS_error
Writes an error message to the standard error output device (the console). Input parameter: AX contains an MSDOS error code.

Get_Commandtail
Gets a copy of the DOS Command Tail at PSP:80h.  Input parameters: BX = the PSP segment and DS:SI points to a buffer to hold a copy of the Command Tail.

Get_Deviceparms
Get the Device BPB table for a disk drive, found in its device driver. Input parmeters: BL = drive number (0 = default drive, 1 = A, 2 = B, etc.). Output: AX points to a ParameterStruc (structure) where DOS stores the device information.

Get_Diskfreespace
Returns the amount of free space on a selected drive. Input: AL = drive (0=A, 1=B, 2=C). Output: DX:AX = free space.

Get_Disksize
Returns the size (in bytes) of a specified disk drive. Input parameters: AL = drive number (0=A, 1=B, 2=C, etc.). Output: DX:AX = disk space.

Get_time
Get the current system time.Input parameter: DS:SI points to a TimeRecord structure.

Gotoxy
Locates the cursor at row, col on video page zero. Input parameters: DH = row, DL = column.

Open_infile
Open a file for input. Input parameter: DX = offset of ASCIIZ file name. Output: AX = file handle.

Open_outfile
Open a file for output. Input parameter: DX = offset of ASCIIZ file name. Output: AX = file handle.

PackedToBin
Convert the BCD value in AL to a binary byte, which is returned in AL.

Randomize
Reseeds the random number generator. No input or output required.

Random_range
Return an unsigned pseudorandom 32-bit integer in EAX, between 0 and n1. Input parameter: EAX = n.

Random32
Return an unsigned pseudorandom 32-bit integer in EAX,in the range 0 to FFFFFFFFh.

Readchar
Reads a single character from standard input without echoing the character or waiting for input. Output: If a character was found, ZF = 0 and AL contains the character. If no character was found, ZF = 1.

Readint
Read a signed decimal number from standard input, range 32768 to +32767. Skip leading spaces. Returns the 16-bit binary value of the number in AX. No other registers are changed.

Readkey
Waits for a key until one is pressed. Returns the scan code in AH and the ASCII code in AL. Cannot be redirected.

Readlong
Reads a 32-bit signed decimal integer from standard input, stopping when the Enter key (0dh) is read. Leading spaces are ignored. Output: EAX contains the number typed by the user, in binary.

Read_record
Read a block of data from an input file. Input parameters: DX points to input buffer, BX = file handle, CX = number of bytes to read.

Readstring
Uses INT 21h to read a string from standard input, stopping when 0Dh is found. Input parameters: DS:DX points to the input buffer, CX = maximum characters that may be typed. Output: The buffer is initialized to an ASCIIZ (null-terminated) string, and AX = size of the input string.

Scroll
Scrolls all lines in a prescribed window. No range checking is performed on the input parameters:
    CH    Row of the window's upper left corner
    CL    Column of the window's upper left corner
    DH    Row of the window's lower right corner
    DL    Column of the window's lower right corner
    BH    Attribute/color of the scrolled lines

Seconds_today
Returns a count of the number of seconds that have elapsed today. Output: EAX contains the return value.

Seek_eof
Move the DOS file pointer to the end of file. Input: BX = file handle of an open file Output: DX:AX = new file pointer offset.

Seek_record
Move the DOS file pointer to a specific record in a file. Input parameters: AX = record number, BX = file handle, CX = record length. Output: DX:AX = new file pointer offset.

Set_videoseg
Set the current video segment address (the default is B800h). Input parameter: AX contains the segment address value.

Show_time
Write a TimeRecord structure in 24-hour military format to standard output. Input: DS:SI points to the structure.

Str_compare
Compares a string pointed to by DS:SI (called 'first') to a string pointed to by ES:DI (called 'second'). The comparison is case-sensitive, and the Flags register is affected as follows:
    first < second     CF=1, ZF=0
    first = second     CF=0, ZF=1
    first > second     CF=0, ZF=0

Str_copy
Copies a null-terminated source string to a destination string. Input parameters: DS:SI points to the source and ES:DI points to the destination. No range checking is performed on the destination.

Str_length
Returns the length of a null-terminated string. Input parameter: ES:DI points to the string. Output: AX contains the string length.

Str_ucase
Converts a null-terminated string to upper case. Input parameter: DS:SI points to the string.

Waitchar
Reads a single character from standard input without echoing the character. Waits for input. Output: AL contains the character.

Writebcd
Writes the ASCII representation of a packed BCD byte to standard output. Input parameter: AL contains the BCD byte. Also works for binary hexadecimal bytes.

Writechar
Write a character to standard output, using INT 21h. Input parameter: AL = character.

Writechar_direct
Write a character directly to video RAM. Input parameters: AL = character, AH = attribute, DH/DL = row, column on screen (0-24, 0-79).

Write_errorstr
Write a string to the standard error output device (the console). Input parameter: DS:DX points to a null-terminated string.

Writeint
Writes a 16-bit unsigned binary integer to standard output. Input parameters: AX = value, BX = radix.

Writeint_signed
Writes a signed binary integer to standard output in ASCII decimal.Input parameter: AX = the binary value.

Writelong
Writes an unsigned 32-bit number to standard output. Input parameters: EAX = the number to write, and EBX = radix.

Writestring
Writes a null-terminated string to standard output. Input parameter: DS:DX points to the string.

Writestring_Direct
Write a string directly to video RAM. Input parameters: DS:SI points to a null-terminated string, AH = attribute, DH/DL = row/column on the screen (0-24, 0-79).
 
 

TimeRecord

TimeRecord struc

  hours db ?

  minutes db ?

  seconds db ?

  hhss db ?

TimeRecord ends
 

 

ParameterStruc

ParameterStruc struc 

  specialFunctions db ?

  deviceType db ?

  deviceAttributes dw ?

  numberCylinders dw ?

  mediaType db ?

  bytesPerSector dw ? 

  sectorsPerCluster db ?

  reservedSectors dw ?

  numberOfFATs db ?

  maxRootDirEntries dw ?

  numberOfSectors dw ?

  mediaDescriptor db ?

  sectorsPerFAT dw ?

  sectorsPerTrack dw ?

  numberOfHeads dw ?

  numHiddenSectors dd ?

  numberSectorsLong dd ?       ; used if numberOfSectors = 0

  reservedBytes db 6 dup(?)

  trackLayout dw 40 dup(0)     ; specific track data

ParameterStruc ends