The StringConcatenate function
The StringConcatenate function copies the contents of the second null-terminated string to the end of the first string.
Parameters: DS:AX - pointer to the first string; ES:BX - pointer to the second string.
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 StringConcatenate function to concatenate two strings.
title .model small .stack 100h data segment public string1 db "Hello World \0" db 20 dup(0) ; Add 20 bytes to fit string2 string2 db 8086 Assembler!\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:[string2] ; Load the address of the variable string2 into the es:bx register lea ax, ds:[string1] ; Load the address of the variable string1 into the ds:ax register call StringConcatenate ; Call the StringConcatenate procedure (ds:ax, es:bx) lea ax, ds:[string1] ; Load the address of the variable string1 into the ds:ax register call WriteString ; Call the WriteString procedure (ax:string1) 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
Hello World 8086 Assembler!
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".