GAS Bubblesort

Publicado por Perfil removido (última atualização em 16/08/2011)

[ Hits: 5.201 ]

Download bubblesort.s




Algoritmo de ordenação bubblesort ordenando uma string.

  



Esconder código-fonte

.section .data

    vetor: .ascii "92ASOCOMCDOKAapijsoaijs8373Ewerton Daniel de Lima\n"

.section .text
_start:

movl $4, %eax
movl $1, %ebx
movl $vetor, %ecx
movl $50, %edx
  
int $0x80
 
loopExt:
movl $vetor, %edi
movl $48, %ecx

movl $0,  %edx

   loopInt:
   dec %ecx
   movb (%edi), %eax
   inc %edi
   movb (%edi), %ebx

   cmp %eax, %ebx
   jnl noChange

   movl $1, %edx
   movb %eax, (%edi)
   dec %edi
   movb %ebx, (%edi)
   inc %edi

noChange:
cmp $0, %ecx
jne loopInt
cmp $0, %edx
jne loopExt


movl $4, %eax
movl $1, %ebx
movl $vetor, %ecx
movl $50, %edx
int $0x80
 
movl $1, %eax
movl $0, %ebx
int $0x80
#@

Scripts recomendados

Expressão matemática em C

Fatorial de N em Assembly

Retorna o maior e menor elemento de um vetor em Assembly

Escrita de um número em decimal na tela em Assembly Puro para Linux x86 (GNU Assembler)

FreeBSD Write


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário