Category : Assembly Language Source Code
Archive   : BLUEBOOK.ZIP
Filename : STRINGS.DOC

 
Output of file : STRINGS.DOC contained in archive : BLUEBOOK.ZIP
STRINGS.DOC -- Description of Routines in STRINGS.ASM
=====================================================

From `BLUEBOOK of ASSEMBLY ROUTINES for the IBM PC & XT'
by Christopher L. Morgan
Copyright (C) 1984 by The Waite Group, Inc.

Purpose: The routines in STRINGS.ASM are used to manipulate strings.

Contents:
---------
COMPARE -- Compare two strings
LEXINSERT -- Lexigraphically insert
LEXSEARCH -- Search a lexigraphically ordered list
LOWERCASE -- Convert to lower case
SORTB -- Bubble sort a string array
STRINSERT -- Insert one string in another
STRSEARCH -- Search for one string within another
SWITCH -- Switch two strings
UPPERCASE -- Convert to upper case
_______________________________________________________________________________

Overview:
---------
LOWERCASE & UPPERCASE convert characters within a string to the other
case.
STRSEARCH & STRINSERT require two input strings. STRSEARCH searches

for a copy of one string in another, and STRINSERT inserts a copy of one
string within another.
LEXSEARCH & LEXINSERT require a string and a LIST of strings as input.
LEXSEARCH searches for the proper place to insert a string in a
lexigraphically-ordered list of strings LEXINSERT inserts a string in the
proper place in a lexigraphically-ordered list of strings. Lexigraphic is
the same as alphabetic, except these routines are ordered according to their
ASCII code. So all uppercase letters precede any lowercase letter.
These procedures can easily be modified so all lowercase letters are first
converted to uppercase before lexigraphic comparison.
LEXINSERT calls LEXSEARCH to find the proper spot, then calls
STRINSERT to make the insertion.
COMPARE, SWITCH, AND SORTB work with string arrays. COMPARE compares
two strings of equal length. It lets you compare two different entries of
the same string array. SWITCH switches two strings of the same length e.g.,
two different entries of the same string array. Both these routines are
needed by SORTB, which performs a bubble sort of a string array.
These routines take advantage of the 8088 string instructions.

_____________________________ROUTINE DESCRIPTIONS______________________________

LOWERCASE -- Convert to Lower Case

Function: This routine converts the characters in a string to lower case.

Input: Upon entry, DS:BX points to a string. The first two bytes in the
string form a 16-bit integer which specifies its length. The remaining
bytes contain the characters of the string.

Output: Upon exit, all alphabetical characters of the string are lower case.

Registers used: AX, BX, & CX are first saved and then restored.

Segments referenced: Upon entry, the data segment must contain the string.
_______________________________________________________________________________

UPPERCASE -- Convert to Upper Case

Function: This routine converts the characters in a string to upper case.

Input: Upon entry, DS:BX points to a string. The first two bytes in the
string form a 16-bit integer which specifies its length. The remaining
bytes contain the characters of the string.

Output: Upon exit, all alphabetical characters of the string are upper case.

Registers used: AX, BX, & CX are first saved and then restored.

Segments referenced: Upon entry, the data segment must contain the string.
_______________________________________________________________________________

STRSEARCH -- Search for One String Within Another

Function: This routine searches for a copy of a source string within a
destination string.

Input: Upon entry, DS:BX points to a source string and ES:DX points to a
destination string. Each string begins with a 16-bit integer that
specifies its length.

Output: Upon exit, AL contains a return flag (0=not found, 0FFH=found), and
if the search was successful DX contains the location of the first byte of
the match in the destination.

Registers used: AX & DX are used for output; all others are unmodified.

Segments referenced: Upon entry, the data segment must contain the source
string and the extra segment must contain the destination string.
_______________________________________________________________________________

STRINSERT -- Insert One String in Another

Function: This routine inserts a source string in a specified spot in a
destination string.

Input: Upon entry, DS:BX points to the source string, ES:BP points to the
destination string, and ES:DX points to the spot in the destination where
the source is to be placed. Each string begins with a 16-bit integer that
begins with a 16-bit integer specifying its length.

Output: Upon exit, the destination string has the source string inserted in
the proper location. The length of the destination string is increased
accordingly.

Registers used: SI, DI, CX, & AX are first saved and then restored.

Segments referenced: Upon entry, the data segment must contain the source
string and the extra segment must contain the destination string.
_______________________________________________________________________________

LEXSEARCH -- Search a Lexigraphically Ordered List

Function: This routine searches a lexigraphically (alphabetically) ordered
list of word strings for the proper place to insert a new word.

Input: Upon entry, DS:BX points to a source word string, ES:BP points to the
ordered list of words. The source word string begins with a 16-bit integer
that is its length and is followed by the bytes of the string. The last
byte must be a (ASCII 13). The destination list of words begins with
a 16-bit integer specifying its length, continuing with the words which
must consist of ASCII characters. The words in the list are separated by
's (ASCII 13).

Output: Upon exit, AL contains a return flag (0=not found, 0FFH=found). If
the search was successful, ES:DX contains the location of the proper place
to insert the new word. If the word was already present, then ES:DX points
to the location of this word in the destination.

Registers used: AX & DX are used for output; all else is unmodified.

Segments referenced: Upon entry, the data segment must contain the source
string and the extra segment must contain the destination word list.
_______________________________________________________________________________

LEXINSERT -- Lexigraphically Insert

Function: This routine inserts a word string in the proper place in a
lexigraphically (alphabetically) ordered list of word strings. If the
word is already present, no insertion occurs.

Input: Upon entry, DS:BX points to a source word string and ES:BP points to
the ordered list of words. The source word string begins with a 16-bit
integer specifying its length. The string is ASCII and must be terminated
by a symbol (ASCII 13). The destination list of words begins with a
16-bit integer specifying its length and continues with words consisting
of ASCII characters. The words are separated by symbols (ASCII 13).

Output: Upon exit, the list has the string inserted in the proper place.

Registers used: AX is first saved and then restored.

Segments referenced: Upon entry, the data segment and the extra segment must
be equal and must contain the source string and the destination word list.
_______________________________________________________________________________

COMPARE -- Compare Two Strings

Function: This routine compares two strings of the same length.

Input: Upon entry, DS:SI points to one string (source) and DS:DI points to
the second string (destination). Both strings have lengths given by CX.

Output: Upon exit, the flags show the relation of the source to destination:

L = source string is less than destination string
E = source string is equal to the destination string
G = source string is greater than the destination string

Registers used: AX is modified.

Segments referenced: Upon entry, the data segment contains the source string
and the extra segment contains the destination string.
_______________________________________________________________________________

SWITCH -- Switch Two Strings

Function: This routine switches two strings of equal length.

Input: Upon entry, DS:SI points to one string (source) and ES:DI points to
the second string (destination). Both strings have lengths given by CX.

Output: Upon exit, the strings are switched.

Registers used: AX, CX, DI, & SI are first saved and then restored

Segments referenced: Upon entry, the data segment contains the source and the
extra segment contains the destination string.
_______________________________________________________________________________

SORTB -- Bubble Sort a String Array

Function: This routine sorts a string array using bubble sort.

Input: Upon entry, DS:SI points to a string array, CX contains the number of
entries in the array, and DX contains the size of each entry.

Output: Upon exit, the array is alpha-up sorted.

Registers used: AX, CX, DI, & SI are first saved and then restored

Segments referenced: Upon entry, the data segment and the extra segment must
be equal and must contain the string array.

Routines called: COMPARE, SWITCH
_______________________________________________________________________________
>>>>> Physical EOF STRINGS.ASM <<<<<


  3 Responses to “Category : Assembly Language Source Code
Archive   : BLUEBOOK.ZIP
Filename : STRINGS.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/