david@work:~$ echo $((72 + 21 + 40 + 18 + 12 + 60 + 31 + 99 + 1 + 74)) 428 david@work:~$
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:~$
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.
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:~$
#!/bin/bash name="Vajda" firstname="David" if [[ "$name" == "$2" && "$firstname" == "$1" ]] then echo "Das bin ich" elif [[ "$name" == "$1" && -z "$2" ]] then echo "Das koennte ich sein" else echo "hallo welt" i=0 while [ $i -lt 10 ] do echo "Hallo zum $(($i+1))." i=$(($i+1)) done M=(a b c d) M+=(e f g h) i=0 while [ $i -lt 8 ] do echo "${M[$i]}" i=$(($i+1)) done i=0 for s in "${M[@]}" do echo "$s" done l=$(ls) for s in $l do if [ $i -eq 8 ] then break fi echo $s i=$(($i+1)) done /bin/bash "$0" "David" "Vajda" /bin/bash "$0" "Vajda" fi
hallo welt Hallo zum 1. Hallo zum 2. Hallo zum 3. Hallo zum 4. Hallo zum 5. Hallo zum 6. Hallo zum 7. Hallo zum 8. Hallo zum 9. Hallo zum 10. a b c d e f g h a b c d e f g h 20090712_69b alsapulseaudio.txt assemble.sh bash01.txt bash20240915.out bash20240915.sh bash20240916.out bash20240916.sh Das bin ich Das koennte ich sein