刚刚学AT&T汇编, 写个程序练练手,反正就是写得比较烂的那种
- .section .data
-
values:
-
.int 122, 109, 362, 121, 77, 38, 80, 290, 500, 70
-
.section .text
-
.globl _start
-
_start:
-
movl $values, %edi
-
movl $0, %edx
-
movl $9, %ecx
-
loop:
-
movl (%edi), %eax
-
cmpl %eax, 4(%edi)
-
jge skip
-
xchg %eax, 4(%edi)
-
movl %eax, (%edi)
-
skip:
-
inc %edx
-
cmpl %edx, %ecx
-
je another_loop
-
movl $4, %ebx
-
add %ebx, %edi
-
jmp loop
-
another_loop:
-
dec %ecx
-
cmpl $1, %ecx
-
je end
-
movl $0, %edx
-
movl $values, %edi
-
jmp loop
-
end:
-
movl $0, %ebx
-
movl $1, %eax
-
int $0x80
阅读(1104) | 评论(0) | 转发(0) |