2024-09-19

Image IMG_3231

Image IMG_3232

Image IMG_3233

Image IMG_3234

Image IMG_3235

Image IMG_3236

Image IMG_3237

Image IMG_3238

Image IMG_3239

Image IMG_3240

Image IMG_3241

david@work:~$ echo $((72 + 21 + 40 + 18 + 12 + 60 + 31 + 99 + 1 + 74))
428
david@work:~$

Image IMG_3242

Image IMG_3243

Image IMG_3244

Image IMG_3245

Image IMG_3247

Image IMG_3248

Image IMG_3249

Image IMG_3250

Image IMG_3251

Image IMG_3252

david@work:~$ echo $((8243 + 7516 + 2261))
18020
david@work:~$ echo $((8243 + 7516 + 2261 + 2470 + 9327))
29817
david@work:~$ echo $((8243 + 7516 + 2261 + 2470))
20490
david@work:~$ echo $((8243 + 7516 + 2261 + 2470 + 9327 + 23 + 9670 + 9773))
49283
david@work:~$ echo $((8243 + 7516 + 2261 + 2470 + 9327 + 23 + 9670 + 9773 + 3212 + 4632))
57127
david@work:~$

Image IMG_3253

        global _start
section .data
        str: db "Hallo Welt", 0
section .code
_start:

        mov edx, 10
        mov ecx, str
        mov ebx, 1
        mov eax, 4
        int 0x80

        mov ebx, 0
        mov eax, 1
        int 80h

#!/bin/bash

nasm -f elf32 "$1.asm"
ld -m elf_i386 "$1.o" -o $1
./$1

        global _start
section .data
        str: db "Hallo Welt", 0
section .code
_start:

        mov eax, str
        mov esi, eax
loop1:  mov ah, [esi]
        cmp ah, 0
        je loop1end
        mov edi, esi
loop2:  inc edi
        mov ah, [edi]
        cmp ah, 0
        je loop2end
        mov ah, [esi]
        mov al, [edi]
        cmp ah, al
        jge noexchange
        mov ah, [esi]
        mov al, [edi]
        mov [esi], al
        mov [edi], ah
noexchange:
        jmp loop2
loop2end:
        inc esi
        jmp loop1
loop1end:
        mov edx, 10
        mov ecx, str
        mov ebx, 1
        mov eax, 4
        int 0x80

        mov ebx, 0
        mov eax, 1
        int 80h

tollleaWH david@work:~$ /bin/bash assemble.sh sort20240919
tollleaWH david@work:~$ /bin/bash assemble.sh sort20240919
tollleaWH david@work:~$

        global _start
section .data
        str: db "Hallo Welt", 0
section .code
_start:

        mov eax, str
        mov esi, eax
loop1:  mov ah, [esi]
        cmp ah, 0
        je loop1end
        mov edi, esi
loop2:  inc edi
        mov ah, [edi]
        cmp ah, 0
        je loop2end
        mov ah, [esi]
        mov al, [edi]
        cmp ah, al
        jge noexchange
        mov ah, [esi]
        mov al, [edi]
        mov [esi], al
        mov [edi], ah
noexchange:
        jmp loop2
loop2end:
        inc esi
        jmp loop1
loop1end:
        mov edx, 10
        mov ecx, str
        mov ebx, 1
        mov eax, 4
        int 0x80

        mov ebx, 0
        mov eax, 1
        int 80h

ich spiele jetzt etwas klavier, dann uebe ich kurrent schrift. Danach mache ich mmx Assembler. Ich schreibe mal ein Sortierstring in mmx, fuer Assembler, indem ich die MMX Einheit benutze.

Image IMG_3254

            global      _start
            section     .data
            str:        db "Aber    ", "Hallo   ", "Welt    ", "sagt    ", "David   ", "Vajda   "

            section     .text
_start:

            mov ecx, str
printstart:

            cmp ecx, str + 7*8
            jge printend

            mov edx, 8
            mov ebx, 1
            mov eax, 4
            int 0x80
            add ecx, 8
            jmp printstart

printend:

            mov ebx, 0
            mov eax, 1
            int 80h

david@work:~$ /bin/bash assemble.sh mmxsort20240919
Aber    Hallo   Welt    sagt    David   Vajda   david@work:~$ /bin/bash assemble.sh mmxsort20240919
Aber    Hallo   Welt    sagt    David   Vajda   david@work:~$

            global      _start
            section     .data
            str:        db "Aber    ", "Hallo   ", "Welt    ", "sagt    ", "David   ", "Vajda   "

            section     .text
_start:

            mov ecx, str
            call printstart

            mov edi, str
sortloop1:  mov eax, edi
            cmp eax, str + 8*8
            jge sortloop1end
            mov esi, edi
sortloop2:  add esi, 8
            mov eax, esi
            cmp eax, str + 8*8
            jge sortloop2end
            movq mm0, [esi]
            movq mm1, [edi]
            pcmpgtb mm0, mm1
            jge noexchange
            movq mm0, [esi]
            movq mm1, [edi]
            movq [esi], mm1
            movq [edi], mm0
noexchange:
            jmp sortloop2
sortloop2end:
            add edi, 8
            jmp sortloop1
sortloop1end:

            mov ecx, str
            call printstart

            mov ebx, 0
            mov eax, 1
            int 80h

printstart:

            cmp ecx, str + 7*8
            jge printend

            mov edx, 8
            mov ebx, 1
            mov eax, 4
            int 0x80
            add ecx, 8
            jmp printstart

printend:   ret

david@work:~$ /bin/bash assemble.sh mmxsort20240919b
Aber    Hallo   Welt    sagt    David   Vajda   Vajda   David   sagt    Welt    Hallo   david@work:~$