Advertisement
DMG

Konkatenacija dva stringa

DMG
Nov 15th, 2014
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Program koji spaja dva stringa (konkatenacija stringova)
  2. # dmarjanovic
  3.  
  4. .section .data
  5.     str_1: .ascii "dragutin\0"
  6.     str_2: .ascii "marjanovic\0"
  7.    
  8. .section .text
  9. .globl main
  10.  
  11. main:
  12.     movl $0, %ebx
  13.     movl $0, %esi
  14.    
  15. for_str_1:
  16.     cmpb $0, str_1(,%esi,1)
  17.     je for_str_2
  18.    
  19.     incl %esi
  20.     jmp for_str_1
  21.    
  22.     for_str_2:
  23.         cmpb $0, str_2(,%ebx,1)
  24.         je end
  25.        
  26.         movb str_2(,%ebx,1), %cl
  27.         movb %cl, str_1(,%esi,1)
  28.        
  29.         incl %esi
  30.         incl %ebx
  31.        
  32.         jmp for_str_2
  33.  
  34. end:
  35.     # Upisujemo kraj stringa
  36.     movl $0, str_1(,%esi,1)
  37.  
  38.     movl $1, %eax
  39.     int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement