Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .section .data
- ulazni_tekst: .ascii "Unesite neku rec:"
- ulazni_tekst_len = .-ulazni_tekst
- str1: .fill 50,1,42
- str1_len = 50
- str2: .fill 50,1,42
- .section .text
- .global main
- main:
- #ispisuje Unesite Neku rec:
- movl $4, %eax
- movl $1, %ebx
- leal ulazni_tekst, %ecx
- movl $ulazni_tekst_len, %edx
- int $0x80
- #upisivanje reci
- movl $3, %eax
- movl $0, %ebx
- leal str1, %ecx
- movl $str1_len, %edx
- int $0x80
- movl %eax, %esi #stavljanje duzine niza u esi
- movl %esi, %edi #treba kasnije kad ispisuje
- decl %edi #jer je uracunato i \n
- leal str1, %eax #adresa string u eax
- addl %esi, %eax #pomera pokazivac za esi mesto tj, do kraja stringa i sad pokazuje iza \n
- decl %eax #sad pokazuje na \n
- leal str2, %ebx #adresa stringa gde stavljamo
- prebaci:
- decl %eax
- decl %esi
- cmpl $0, %esi
- je ispis
- movb (%eax), %cl
- movb %cl, (%ebx)
- incl %ebx
- jmp prebaci
- ispis:
- movl $4, %eax
- movl $1, %ebx
- leal str2, %ecx
- movl %edi, %edx
- int $0x80
- kraj:
- movl $1, %eax
- movl $0, %ebx
- int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement