The StringAbbreviate function

The StringAbbreviate function creates an abbreviation from the specified string consisting of the first letters of each word and stores it in a prepared buffer.

Parameters: DS:AX - pointer to the string; ES:BX - pointer to the buffer for the abbreviation.

Return value: The function does not return a value.

Flag state: The function does not modify the flags.

Program source code

An example program for the Intel 8086 assembler demonstrating the use of the StringAbbreviate function to create an abbreviation from a string.

title Author: Evgeny Sergeevich Dovgopolov

.model small
.stack 100h

data segment public
    string  db "United Arab Emirates\0"
    strabbr db 10 dup(0)
data ends

code segment public               ; Start of the code segment
    assume  ds:data, cs:code
    include Handyfar.inc          ; Include the file with functions

    main proc                     ; Start of the main procedure
        call    SetDataSegment    ; Call the SetDataSegment procedure

        lea     bx, es:[strabbr]  ; Load the address of the variable strabbr into the es:bx register
        lea     ax, ds:[string]   ; Load the address of the variable string into the ds:ax register
        call    StringAbbreviate  ; Call the StringAbbreviate procedure (ds:ax, es:bx)

        mov     ax, bx            ; Copy the bx register value into the ax register
        call    WriteString       ; Call the WriteString procedure (ax:strabbr)

        xor     al, al            ; Clear the al register
        call    ExitProcess       ; Call the ExitProcess procedure
    main endp                     ; End of the main procedure

code ends                         ; End of the code segment
end main	                      ; End of file. The main procedure is the entry point

UAE

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".