x86/amd64 - Assembler Übungsprogramm

    global _start
    section    .data
        ToSortStr       db  "oopeppepepppoeernemnremrnemeppepe", 0x00
        ToSortStrlen    dd  0
    section    .text

    _start:

    mov esi, ToSortStr
loop2:
    mov al, [esi]
    cmp al, 0x00
    je loop2end
    mov edi, esi
loop3:
    inc edi
    mov al, [edi]
    cmp al, 0x00
    je loop3end
    mov al, [esi]
    mov ah, [edi]
    cmp al, ah
    jge noexchange
    mov al, [esi]
    mov ah, [edi]
    mov [esi], ah
    mov [edi], al
noexchange:
    jmp loop3
loop3end:
    inc esi
    jmp loop2
loop2end:



    mov ecx, 0x00
    mov esi, ToSortStr
loop1:
    inc ecx
    lodsb
    cmp al, 0x00
    jne loop1

    mov edx, ecx
    mov ecx, ToSortStr
    mov ebx, 1
    mov eax, 4
    int 0x80

    mov ebx, 0
    mov eax, 1
    int 80h
Ausführen mit
david@work:~$ nasm -f elf32 nasm20241121.asm
david@work:~$ ld -m elf_i386 nasm20241121.o -o nasm20241121
david@work:~$ ./nasm20241121
rrrppppppppppooonnnmmmeeeeeeeeeeedavid@work:~$