TITLE Concat (Concat.asm) ; Program Description: This program uses a procedure to take a source ; string and add it to the end of the target string ; Author: Brian Brindle INCLUDE Irvine32.inc Str_concat PROTO, target:PTR BYTE, source:PTR BYTE .data targetStr BYTE "ABCDE",10 DUP(0) sourceStr BYTE "FGH",0 .code main PROC call Clrscr Invoke Str_concat, ADDR targetStr, ADDR SourceStr mov edx, OFFSET targetStr call WriteString call Crlf exit main ENDP ;--------------------------------------------------------- ;This function will concatenate a source string to the end ;of a target string ;Receives: the address of the source and target strings ;Returns: nothing ;--------------------------------------------------------- Str_concat PROC USES eax ebx ecx esi edi, target:PTR BYTE, source:PTR BYTE mov eax, 5 ; the size of target string mov ecx, SIZEOF source ; ecx determines number of loops mov esi, source mov edi, target L1: add edi, eax ; end of target string mov ebx, [esi] mov [edi], ebx ; copy Byte to the end of target add eax, 1 add esi, 1 loop L1 ret Str_concat ENDP END main