Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .section .data
- niz1: .long -6, -5, 4, 6, 7
- niz2: .long 0, 0, 0, 0, 0
- .section .text
- .globl main
- main:
- movl $0, %esi
- movl $2, %ebx
- poredi:
- cmpl $4, %esi
- je kraj
- cmpl $-5, niz1(, %esi, 4)
- jge veci
- jl manji
- manji:
- movl niz1(, %esi, 4), %eax
- imull %eax
- movl %eax, niz2(, %esi, 4)
- addl $1, %esi
- jmp poredi
- veci:
- cmpl $5, niz1(, %esi, 4)
- jg veciveci
- jmp vecimanji
- vecimanji:
- cmpl $0, niz1(, %esi, 4)
- jg poz
- jl neg
- je nula
- poz:
- movl $0, %edx
- movl niz1(, %esi, 4), %eax
- idivl %ebx
- neg:
- movl $0xffffffff, %edx
- movl niz1(, %esi, 4), %eax
- idivl %ebx
- nula:
- movl $0, %edx
- movl %edx, niz2(, %esi, 4)
- addl $1, %esi
- jmp poredi
- veciveci:
- movl %esi, %edi
- movl $0, %eax
- addl niz1(, %esi, 4), %eax
- cmpl $0, %esi
- je prvi
- cmpl $4, %esi
- je poslednji
- subl $1, %edi
- addl niz1(, %edi, 4), %eax
- addl $2, %edi
- addl niz1(, %edi, 4), %eax
- movl %eax, niz2(, %esi, 4)
- prvi:
- addl $1, %edi
- addl niz1(, %edi, 4), %eax
- movl %eax, niz2(, %esi, 4)
- addl $1, %esi
- jmp poredi
- poslednji:
- subl $1, %edi
- addl niz1(, %edi, 4), %eax
- movl %eax, niz2(, %esi, 4)
- addl $1, %esi
- jmp kraj
- kraj:
- movl $1, %eax
- movl $0, %ebx
- int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement