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

Recommended Answers

All 2 Replies

any idea?

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.