Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .section .data
  2. uneti: .fill 51,1,0
  3. duzina = 51
  4. prepisan: .fill 51,1,0
  5. poruka1: .ascii "Unesite string: \0"
  6. br_poruka1 = . - poruka1
  7. poruka2: .ascii "Dobijeni string: \0"
  8. br_poruka2 = . - poruka2
  9.  
  10. main:
  11.     movl $4, %eax   #ispis unesite string
  12.     movl $1, %ebx
  13.     leal poruka1, %ecx
  14.     movl $br_poruka1, %edx
  15.     int $0x80
  16.    
  17.     movl $3, %eax   #unos stringa
  18.     movl $0, %ebx
  19.     leal uneti, %ecx
  20.     movl $duzina, %edx
  21.     int $0x80
  22.    
  23.     movl $0, %esi
  24.    
  25. proveri:
  26.     movl %esi, %edi
  27.     cmpb $0, uneti(,%esi, 1)
  28.     je ispis
  29.     cmpb $48, uneti(,%esi, 1)
  30.     jb izbaci
  31.     cmpb $57, uneti(,%esi, 1)
  32.     ja izbaci
  33.    
  34.     addl $1, %esi
  35.     jmp provera
  36.  
  37.    
  38. izbaci:
  39.     cmpb $0, uneti(,%esi, 1)
  40.     je nastavi
  41.     movl uneti(,%edi, 1)
  42.    
  43. nastavi:
  44.    
  45.    
  46.    
  47. ispis:
  48.     movl $4, %eax   #ispis dobijen string
  49.     movl $1, %ebx
  50.     leal poruka2, %ecx
  51.     movl $br_poruka2, %edx
  52.     int $0x80
  53.    
  54.     movl $4, %eax   #ispis stringa
  55.     movl $1, %ebx
  56.     leal uneti, %ecx
  57.     movl $duzina, %edx
  58.     int $0x80
  59.  
  60.  
  61. kraj:
  62.     movl $1, %eax
  63.     movl $0, %ebx
  64.     int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement