Improved Handyfar function library (Ex)
An extended version of the library focused on convenience and new capabilities. All functions take their parameters through the stack and align it automatically, which simplifies writing code and allows C-style nested calls. Support for color output and new specifiers has been added.
1.
ExitProcessEx
Terminates the process. The return code is passed through the stack. Automatically aligns the stack to 2 bytes.
2.
PutCharEx
Prints a character from the stack to the screen. Automatically aligns the stack to 2 bytes.
3.
PutCharExD
Prints a character with the specified background and text colors. The parameters are passed through the stack. Aligns the stack to 6 bytes.
4.
WriteStringEx
Prints a string whose address is passed through the stack. Supports control sequences (\n, \t). Aligns the stack to 2 bytes.
5.
WriteStringExD
Prints a string with color highlighting of fragments through ${}. Returns the number of characters printed in AX. Aligns the stack to 6 bytes.
6.
ReadStringEx
Reads a string from the keyboard into a buffer whose address is passed through the stack. Aligns the stack to 2 bytes.
7.
ToLowerCharEx
Converts a character from the stack to lowercase. Returns it in AL and leaves it on the stack. Does not align the stack, which allows nested calls.
8.
ToUpperCharEx
Converts a character from the stack to uppercase. Returns it in AL and on the stack. Does not align the stack.
9.
ToLowerStringEx
Converts the string pointed to by the stack pointer to lowercase. Returns the pointer in AX and on the stack. Does not align.
10.
ToUpperStringEx
Converts the string pointed to by the stack pointer to uppercase. Returns the pointer. Does not align the stack.
11.
CapitalizeEx
Converts the first letter of each sentence in a string to uppercase. The string is passed through the stack. Returns the pointer.
12.
IsDigitEx
Checks whether the character from the stack is a digit. The result is in the ZF flag. Automatically aligns the stack to 2 bytes.
13.
IsLowerEx
Checks whether the character from the stack is lowercase. The result is in ZF. Aligns the stack to 2 bytes.
14.
IsUpperEx
Checks whether the character from the stack is uppercase. The result is in ZF. Aligns the stack to 2 bytes.
15.
IsAlphaEx
Checks whether the character from the stack is a letter. The result is in ZF. Aligns the stack to 2 bytes.
16.
IsAlnumEx
Checks whether the character from the stack is a letter or a digit. The result is in ZF. Aligns the stack to 2 bytes.
17.
IsSpaceEx
Checks whether the character from the stack is whitespace. The result is in ZF. Aligns the stack to 2 bytes.
18.
IsCntrlEx
Checks whether the character from the stack is a control character. The result is in ZF. Aligns the stack to 2 bytes.
19.
IsPrintEx
Checks whether the character from the stack is printable. The result is in ZF. Aligns the stack to 2 bytes.
20.
IsGraphEx
Checks whether the character from the stack is graphical (printable, except the space). The result is in ZF. Aligns the stack to 2 bytes.
21.
IsPunctEx
Checks whether the character from the stack is a punctuation mark. The result is in ZF. Aligns the stack to 2 bytes.
22.
IsHexadecimalEx
Checks whether the character from the stack is valid in HEX (0-9, A-F, a-f). The result is in ZF. Aligns the stack to 2 bytes.
23.
PrintFormatTimeEx
Prints a time string, replacing %h, %m, %s with hours, minutes and seconds. The string address is on the stack. Aligns the stack to 2 bytes.
24.
SetPrecisionEx
Sets the precision (the number of digits after the decimal point) for printing floating-point numbers. The parameter is on the stack. Aligns the stack to 2 bytes.
25.
StringLengthEx
Returns the length of the string pointed to by the stack pointer. The result is in AX. Aligns the stack to 2 bytes.
26.
StringCompareEx
Compares two strings (the pointers are on the stack). The result is in AX and the flags. Aligns the stack to 4 bytes.
27.
StringCopyEx
Copies a string from the source into the destination buffer. The addresses are on the stack. Aligns the stack to 4 bytes.
28.
StringCopyIfEx
Copies characters from a string into a buffer if they satisfy the function condition (the function pointer is passed through the stack). Aligns the stack to 6 bytes.
29.
StringCopyIfNotEx
Copies the characters that do NOT satisfy the function condition. Aligns the stack to 6 bytes.
30.
StringConcatenateEx
Appends the second string to the end of the first one. The addresses are on the stack. Aligns the stack to 4 bytes.
31.
StringTrimEx
Removes the specified characters from the beginning and the end of a string, storing the result in a buffer. Aligns the stack to 6 bytes.
32.
StringSpanEx
Returns the length of the initial span of a string consisting of characters found in another string. Aligns the stack to 4 bytes.
33.
StringReverseEx
Reverses a string within the specified index range. The parameters are on the stack. Aligns the stack to 6 bytes.
34.
StringTitleEx
Converts the first letter of each word to title case. The string is on the stack. Returns the pointer. Does not align.
35.
StringSplitEx
Splits a string into tokens by delimiters and stores them in a buffer. Returns the number of tokens in CX. Aligns the stack to 6 bytes.
36.
StringJoinEx
Joins an array of strings into one with the specified separator. Aligns the stack to 8 bytes.
37.
StringAbbreviateEx
Creates an abbreviation from a string, storing it in a buffer. Aligns the stack to 4 bytes.
38.
StringStartsWithEx
Checks whether the string starts with the substring (the pointers are on the stack). The result is in ZF. Aligns the stack to 4 bytes.
39.
StringEndsWithEx
Checks whether the string ends with the substring. The result is in ZF. Aligns the stack to 4 bytes.
40.
StringReplaceCharEx
Replaces all occurrences of one character in a string with another one. Returns the pointer. Aligns the stack to 4 bytes.
41.
StringGetDigitsEx
Analyses the string from the stack and returns the digits found in it. The result is in AX. Aligns the stack to 2 bytes.
42.
FindCharEx
Searches for a character in a string (the parameters are on the stack). Returns a pointer or 8000h with CF=1. Aligns the stack to 4 bytes.
43.
FindSubStringEx
Searches for a substring in a string. Returns a pointer or 8000h with CF=1. Aligns the stack to 4 bytes.
44.
ArrayCompareEx
Compares two arrays element by element. The result is in the ZF flag. Aligns the stack to 6 bytes.
45.
ArrayCopyEx
Copies the specified number of elements from one array to another. Aligns the stack to 6 bytes.
46.
ArrayCopyIfEx
Copies the elements if they satisfy the condition of the user function. Aligns the stack to 8 bytes.
47.
ArrayCopyIfNotEx
Copies the elements that do NOT satisfy the condition of the user function. Aligns the stack to 8 bytes.
48.
ArrayConcatenateEx
Appends the elements of the second array to the end of the first one. Returns the total count in CX. Aligns the stack to 8 bytes.
49.
ArrayGetAverageEx
Computes the arithmetic mean of the array elements. Aligns the stack to 4 bytes.
50.
ArrayGetMinimumEx
Finds the minimum value in an array. The result is in AX. Aligns the stack to 4 bytes.
51.
ArrayGetMaximumEx
Finds the maximum value in an array. The result is in AX. Aligns the stack to 4 bytes.
52.
ArrayMakeUniqueEx
Copies the unique elements from the source array to the destination array. Returns the count in CX. Aligns the stack to 6 bytes.
53.
ArraySortEx
Sorts an array in ascending or descending order. Aligns the stack to 6 bytes.
54.
ArrayMergeSortEx
Merges two arrays into a third one and sorts it. Returns the number of elements in CX. Aligns the stack to 12 bytes.
55.
ArrayAbsoluteEx
Replaces each element of the array with its absolute value. Aligns the stack to 4 bytes.
56.
ArrayNegateEx
Replaces each element of the array with its negated value. Aligns the stack to 4 bytes.
57.
GetMinimumEx
Returns the smaller of two numbers (the parameters are on the stack). The result is in AX. Aligns the stack to 4 bytes.
58.
GetMaximumEx
Returns the larger of two numbers (the parameters are on the stack). The result is in AX. Aligns the stack to 4 bytes.
59.
CreateFileEx
Creates a file with the specified attributes. The parameters are on the stack. Returns the handle or an error code in AX, and the CF flag. Aligns the stack to 4 bytes.
60.
OpenFileEx
Opens a file in the specified mode. The parameters are on the stack. Returns the handle or an error code. Aligns the stack to 4 bytes.
61.
ReadFileEx
Reads data from an open file into a buffer. The parameters are on the stack. Returns the number of bytes read or an error code. Aligns the stack to 6 bytes.
62.
ReadFileExD
Opens a file, reads the data and closes it by itself. The parameters are on the stack. Aligns the stack to 6 bytes.
63.
WriteFileEx
Writes data from a buffer to an open file. The parameters are on the stack. Returns the number of bytes written or an error code. Aligns the stack to 4 bytes.
64.
WriteFileExD
Opens a file, writes the data and closes it by itself. The parameters are on the stack. Aligns the stack to 4 bytes.
65.
CloseHandleEx
Closes the file handle passed through the stack. Aligns the stack to 2 bytes.
66.
RenameFileEx
Renames a file. The old and the new names are passed through the stack. Aligns the stack to 4 bytes.
67.
DeleteFileEx
Deletes a file. The file name is passed through the stack. Aligns the stack to 2 bytes.
68.
CopyFileEx
Copies a file from the source to the destination. The paths are on the stack. Aligns the stack to 4 bytes.
69.
MoveFileEx
Moves a file from the source to the destination. The paths are on the stack. Aligns the stack to 4 bytes.
70.
FindFirstFileEx
Searches for the first file by pattern and attributes. The parameters are on the stack. Aligns the stack to 6 bytes.
71.
FindAllFilesEx
Searches for all files by pattern and stores the names in a buffer, separating them with the 7Fh character. The parameters are on the stack. Aligns the stack to 6 bytes.
72.
CreateFolderEx
Creates a new folder. The folder name is on the stack. Aligns the stack to 2 bytes.
73.
RenameFolderEx
Renames a folder. The old and the new names are on the stack. Aligns the stack to 4 bytes.
74.
DeleteFolderEx
Deletes an empty folder. The folder name is on the stack. Aligns the stack to 2 bytes.
75.
SetCursorPositionEx
Sets the cursor to the position (column, row). The parameters are on the stack. Aligns the stack to 4 bytes.