Handyfar function library
An extensive collection of ready-made functions for Intel 8086 assembly programming. Here you will find everything you need for input/output, string and character processing, arrays and file system operations.
1.
SetDataSegment
Sets the data segment (DS) and the extra segment (ES) for correct access to the program data.
2.
ExitProcess
Terminates the process, returning the exit code passed in the AL register.
3.
PutChar
Outputs the character whose code is passed in the AL register to the screen.
4.
GetChar
Reads a single character entered by the user from the keyboard and returns it in the AL register.
5.
WriteString
Outputs a null-terminated string to the screen. Supports escape sequences (\n, \t, etc.).
6.
ReadString
Reads user input from the keyboard and stores it in a prepared null-terminated buffer.
7.
ToLowerChar
Converts a character of the English and Russian alphabet from uppercase to lowercase.
8.
ToUpperChar
Converts a character of the English and Russian alphabet from lowercase to uppercase.
9.
ToLowerString
Converts a string consisting of characters of the English and Russian alphabet to lowercase.
10.
ToUpperString
Converts a string consisting of characters of the English or Russian alphabet to uppercase.
11.
Capitalize
Converts the first character of each sentence in the string to a capital letter. Sentences are separated by '.', '!' and '?'.
12.
IsDigit
Checks whether the given character is numeric (a digit from 0 to 9). Returns the result in the ZF flag.
13.
IsLower
Checks whether the given character is a lowercase letter. The result is in the ZF flag.
14.
IsUpper
Checks whether the given character is a capital letter (in uppercase). The result is in the ZF flag.
15.
IsAlpha
Checks whether the given character is a letter (lowercase or uppercase). The result is in the ZF flag.
16.
IsAlnum
Checks whether the given character is alphanumeric (a letter or a digit). The result is in the ZF flag.
17.
IsSpace
Checks whether the given character is a whitespace character (space, tab, newline, etc.). The result is in the ZF flag.
18.
IsCntrl
Checks whether the given character is a control character (00h-1Fh, 7Fh). The result is in the ZF flag.
19.
IsPrint
Checks whether the given character is printable (20h-7Eh). The result is in the ZF flag.
20.
IsGraph
Checks whether the character is graphic (printable characters excluding the space). The result is in the ZF flag.
21.
IsPunct
Checks whether the character is a punctuation mark (graphic, not alphanumeric). The result is in the ZF flag.
22.
IsHexadecimal
Checks whether the character is a valid hexadecimal digit (0-9, A-F, a-f). The result is in the ZF flag.
23.
PrintFormatString
Formatted output to the console. Supports %c, %s, %d, %i, %o, %b, %h, %f, %a, width and padding control.
24.
ScanFormatString
Formatted input from the keyboard. Reads data according to the format string and stores it at the specified addresses.
25.
PrintFormatTime
Outputs a string, replacing the %h, %m and %s specifiers with the current hours, minutes and seconds.
26.
SetPrecision
Sets the number of digits after the decimal point for floating-point output.
27.
RoundFloor, RoundCeil, RoundNearest
Rounds the floating-point number at the top of the FPU stack down, up or to the nearest integer.
28.
StringLength
Calculates the string length of a null-terminated string. The result is returned in the AX register.
29.
StringCompare
Lexicographic comparison of two null-terminated strings. Returns the result in AX and the flags.
30.
StringCopy
Copies the contents of the source string into the destination buffer, including the terminating null.
31.
StringCopyIf
Copies characters from a string into a buffer if they satisfy the condition of the given function (for example, IsDigit).
32.
StringCopyIfNot
Copies characters from a string into a buffer if they do NOT satisfy the condition of the given function.
33.
StringConcatenate
Appends the contents of the second string to the end of the first string.
34.
StringTrim
Removes the specified characters (spaces by default) from the beginning and end of a string, storing the result in a buffer.
35.
StringSpan
Returns the length of the initial segment of a string consisting only of the characters found in another string.
36.
StringReverse
Reverses the order of characters in a string, in whole or within the specified span of indices.
37.
StringTitle
Converts the first character of each word in the string to title case.
38.
StringSplit
Splits a string into tokens using the specified delimiters and stores them in a buffer.
39.
StringJoin
Joins an array of strings into one using the specified delimiter character.
40.
StringAbbreviate
Creates an abbreviation from a string by taking the first letter of each word.
41.
StringStartsWith
Checks whether the string starts with the given substring. The result is in the ZF flag.
42.
StringEndsWith
Checks whether the string ends with the given substring. The result is in the ZF flag.
43.
StringReplaceChar
Replaces all occurrences of the given character in a string with another character.
44.
StringGetDigits
Analyses a string and returns the digits found in the string.
45.
FindChar
Searches for the first occurrence of a character in a string. Returns a pointer to it or 8000h with CF=1 if not found.
46.
FindSubString
Searches for the first occurrence of a substring in a string. Returns a pointer or 8000h with CF=1 if not found.
47.
ArrayCompare
Compares two arrays element by element. Sets the ZF=1 flag if the arrays are equal.
48.
ArrayCopy
Copies the specified number of elements from the source array into the destination array.
49.
ArrayCopyIf
Copies elements from one array to another if they satisfy the condition of a user function.
50.
ArrayCopyIfNot
Copies the elements that do NOT satisfy the condition of a user function.
51.
ArrayConcatenate
Appends the elements of the second array to the end of the first array. Returns the total number of elements.
52.
ArrayGetAverage
Calculates the arithmetic mean of the array elements.
53.
ArrayGetMinimum
Finds the minimum value in the array.
54.
ArrayGetMaximum
Finds the maximum value in the array.
55.
ArrayMakeUnique
Copies the unique elements from the source array into the destination array.
56.
ArraySort
Sorts the array in ascending (ASCENDING) or descending (DESCENDING) order.
57.
ArrayMergeSort
Merges two arrays into a third one and sorts the result in ascending order.
58.
ArrayAbsolute
Converts each array element to its absolute value.
59.
ArrayNegate
Replaces each array element with its negative value.
60.
GetMinimum
Returns the smaller of the two numbers passed in the AX and BX registers.
61.
GetMaximum
Returns the larger of the two numbers passed in the AX and BX registers.
62.
CreateFile
Creates a new file with the specified attributes. Returns the file descriptor or an error code.
63.
OpenFile
Opens an existing file for reading, writing or reading and writing. Returns the descriptor.
64.
ReadFile
Reads the specified number of bytes from a file into a buffer. Returns the number of bytes read.
65.
WriteFile
Writes data from a buffer to a file. Returns the number of bytes successfully written.
66.
CloseHandle
Closes an open file descriptor.
67.
RenameFile
Renames a file. Takes the current and the new name.
68.
DeleteFile
Deletes the file with the specified name.
69.
CopyFile
Copies a file from the source path to the specified destination.
70.
MoveFile
Moves a file from the source path to the specified destination.
71.
FindFirstFile
Searches for the first file matching the pattern and stores its name in a buffer.
72.
FindAllFiles
Searches for all files matching the pattern and stores their names in a buffer, separating them with the 7Fh character.
73.
PrintFormatFile
Formatted output to a file. Works like PrintFormatString but writes to a file.
74.
ScanFormatFile
Formatted input from a file. Reads data from a file according to the format string.
75.
CreateFolder
Creates a new directory (folder).
76.
RenameFolder
Renames an existing directory.
77.
DeleteFolder
Deletes an empty directory.
78.
GetKeyState
Waits for a key press and returns its scan code in the AX register.
79.
SetCursorPosition
Sets the cursor to the specified position on the screen (row, column).
80.
GetCursorPosition
Returns the current cursor position (row in AH, column in AL).
81.
ShowStatusFlags
Outputs the current state of the main processor flags (OF, DF, IF, SF, ZF, AF, PF, CF) to the console.