Professional Documents
Culture Documents
Concatination String
Concatination String
Concatination String
data
string1 db 'Hello', 0
string2 db ' World', 0
result_buffer db 50
section .text
global _start
_start:
mov esi, string1 ; Source address (string1)
mov edi, result_buffer ; Destination address
call copy_string ; Call subroutine to copy string
print_string:
; Print the null-terminated string at the address in ecx
mov edx, ecx ; length of the string
call print_string_length
ret
print_string_length:
; Print the null-terminated string at the address in edx
mov eax, 4 ; syscall number for sys_write
mov ebx, 1 ; file descriptor 1 (stdout)
int 0x80 ; call kernel
ret