0

i want to simulate something in asm like strcat function in C
strcat("Hello",World") ==> Result "HelloWorld"
please help me to do this iam very begginer in coding
i need just a simple code
.model small
.stack 64
.data
;********************************
s1 db 'hello '
s2 db 'world'
;********************************
.code
main proc near
mov ax, @data
mov ds, ax
mov es, ax

lea di,s1
lea si,s2
mov cx,4
l1:
lodsb
mov [di],al
inc di
loop l1
lea dx,si
mov ah,9
int 21h

p2: mov ax, 4c00h
int 21h
main endp
end main

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by wildgoose
0

You want to write your own strcat function?
Or you merely want to append two strings together in a buffer?

Either way,

dec di
     mov al,0
l1: inc di                  ; scan for end of destination buffer
      test ds:[di],al
      jnz  l1

l2:   mov al,[si]       ; copy src buffer to destination buffer
       inc si
       mov [di]al
       inc di
       test  al,al         ; inclusive terminator, then done
       jnz    l2
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.