Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Program za sortiranje niza u dvostrukoj preciznosti
- # dmarjanovic
- # Duzina je 7*2 (zbog dvostruke preciznosti)
- LENGTH = 14
- .section .data
- array: .quad 132736784648734631, 24, 31, 132736784648734632, 43, 512, 342343254543646643, 625
- .section .text
- .globl main
- main:
- movl $array, %eax
- movl $LENGTH, %esi
- subl $4, %esi
- movl $0, %ebp
- for_1:
- cmpl $0, %esi
- je end
- addl $2, %esi
- for_2:
- cmpl %ebp, %esi
- je go_to_for_1
- # Uporedjuje array(ebp) i array(ebp+1)
- # Prvo uporedjujemo vise bite
- movl 4(%eax,%ebp,4), %ecx
- cmpl %ecx, 12(%eax,%ebp,4)
- jl swap
- jg go_to_for_2
- movl (%eax,%ebp,4), %ecx
- cmpl %ecx, 8(%eax,%ebp,4)
- jl swap
- go_to_for_2:
- addl $2, %ebp
- jmp for_2
- swap:
- movl (%eax,%ebp,4), %ecx
- movl 8(%eax,%ebp,4), %edx
- movl %ecx, 8(%eax,%ebp,4)
- movl %edx, (%eax,%ebp,4)
- movl 4(%eax,%ebp,4), %ecx
- movl 12(%eax,%ebp,4), %edx
- movl %ecx, 12(%eax,%ebp,4)
- movl %edx, 4(%eax,%ebp,4)
- jmp go_to_for_2
- go_to_for_1:
- subl $4, %esi
- movl $0, %ebp
- jmp for_1
- end:
- movl $1, %eax
- int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement