global _start section .data arrayToSort: db 'asdhjasdnasmdsadmads', 0x00 arrayToSortLen: equ \$-arrayToSort section .text _start: mov esi, arrayToSort loop1: mov al, [esi] cmp al, 0x00 je loop1end mov al, [esi] mov edi, esi inc edi loop2: mov bl, [edi] cmp bl, 0x00 je loop2end mov bl, [edi] cmp al, bl jle noexchange mov al, [esi] mov bl, [edi] mov [edi], al mov [esi], bl noexchange: mov al, [esi] inc edi jmp loop2 loop2end: inc esi jmp loop1 loop1end: mov edx, arrayToSortLen mov ecx, arrayToSort mov ebx, 1 mov eax, 4 int 0x80 mov ebx, 0 mov eax, 1 int 0x80
david@laptop-peaq:~\$ david@laptop-peaq:~\$ nasm -f elf32 -g x86_20240317.asm david@laptop-peaq:~\$ ld -m elf_i386 -g x86_20240317.o david@laptop-peaq:~\$ ./a.out aaaaadddddhjmmnsssssdavid@laptop-peaq:~\$