StringConcatenateEx function

The StringConcatenateEx function copies the contents of the second string to the end of the first string. Pointers to the strings are passed through the stack. The function automatically aligns the stack to 4 bytes.

Parameters (stack): 1. Pointer to the first string. 2. 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

Intel 8086 assembly program example demonstrating the use of the StringConcatenateEx function to concatenate two strings.

title Author: Evgeny Sergeevich Dovgopolov

.286C
.model small
.stack 100h

data segment public
    string1 db "Hello World \0", 30 dup(0)
    string2 db "8086 Assembly!\0"
data ends

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

    main proc
        call    SetDataSegment       ; Call the SetDataSegment procedure

        pushs   es:[string2]         ; 2nd: Push the address of variable string2 onto the stack
        pushs   ds:[string1]         ; 1st: Push the address of variable string1 onto the stack
        call    StringConcatenateEx  ; Call procedure StringConcatenateEx(string1, string2)

        pushs   ds:[string1]         ; Push the address of variable string1 onto the stack
        call    WriteStringEx        ; Call procedure WriteStringEx(string1)

        push    0                    ; Push the byte return code onto the top of the stack
        call    ExitProcessEx        ; Call the ExitProcessEx(0) procedure
    main endp

code ends
end main

Hello World 8086 Assembly!

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