;; Das ist eine schwierige Sache Sortierung mit LODSB und STOSB zu machen, weil, wir haben ja, zwei gleichzeitig und dementsprechend, erhoeht ausserdem LODSB jedes mal den Quelltext, jetzt ist das schwieriger - eindeutig. ich bin jetzt so weit gekommen und mache daran wann anders weiter
global _start
section .data
srt_str: db "hajsdahsdajsdjadmmcjajasjdas", 0
str_len: dw 0x00
section .text
_start:
mov ecx, 0
mov esi, srt_str
loop1: lodsb
cmp al, 0
je loop1_end
inc ecx
jmp loop1
loop1_end:
mov esi, srt_str
mov ecx, 0
mov ebx, [str_len]
loop2: cmp ebx, edx
jge loop2_end
mov ecx, edx
inc ecx
loop3:
add esi, ecx
lodsb
mov ah, al
sub esi, ecx
lodsb
cmp ah, al
jge no_exchange
add esi, ecx
stosb
sub esi, ecx
mov al, ah
stosb
no_exchange:
inc ecx
cmp ecx, ebx
jge loop3_end
jmp loop3
loop3_end:
inc edx
jmp loop2
loop2_end:
mov edx, [str_len]
mov ecx, srt_str
mov ebx, 1
mov eax, 4
int 0x80
mov ebx, 0
mov eax, 1
int 80h
rechenaufgaben
1.) Rechne die Zahl in binaer Darstellung in eine Dezimale Darstellung um
1100100111001001b 51657d
2.) Rechne die Zahl in dezimal darstellung in eine Binaerdarstellung um
526 0000001000001110
3.) Addiere die drei Zahlen schriftlich
41247
+ 62710
+ 45683
-----------------
149640
4.) Subtrahiere die letzten drei Zahlen schriftlich von der ersten schriftlich
7996
- 4266
- 2807
- 6866
-----------------
-5943
5.) Rechne die Zahl ins zweier komplement um, mit 8 Bit - und subtrahiere diese zahl von der ersten und rechne das Ergebnis nach dezimal
9 -69 = -60
00001001 10111011 = 11000100
6.) Multipliziere die zwei Zahlen schriftlich
44453*54475 = 2421577175
7.) Dividiere die zwei Zahlen schriftlich
29496/38145 = 0
8.) Errechne x Logarithmisch mit dem Taschenrechner
47473^x = 2125963565
9.) Errechne mit dem Abakus
49 + 44 + 39 + 45 + 0 + 31 + 7 + 31 + 72 + 87
10.) Errechne mit dem Abakus
5759 + 249 + 7670 + 9234 + 3215 + 1072 + 4849 + 8428 + 2337 + 2702
david@work:~$ echo $((49 + 44 + 39 + 45 + 0 + 31 + 7 + 31 + 72 + 87)) 405 david@work:~$
david@work:~$ echo $((5759 + 249)) 6008 david@work:~$ echo $((5759 + 249 + 7670 + 9234 + 3215)) 26127 david@work:~$ echo $((5759 + 249 + 7670 + 9234 + 3215 + 1072 + 4849 + 8428 + 2337 + 2702)) 45515 david@work:~$
Atmega8
.include "m8def.inc"
ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16
ldi r16, 0xff
out DDRD, r16
ldi r16, 0xff
rcall r1_routine
r1_routine:
cpi r16, 0x00
breq r1_routine_end
dec r16
rcall sleep
rcall r1_routine
r1_routine_end:
out PORTD, r16
ret
sleep:
push r17
push r16
ldi r16, 0xff
sleep_loop1:
dec r16
ldi r17, 0xff
sleep_loop2:
dec r17
cpi r17, 0x00
brge sleep_loop2
cpi r16, 0x00
brge sleep_loop1
pop r16
pop r17
ret