6.2.2 - 2


Mov eax, [X]

Cmp eax, [Y]

Jae mx

My:

Mov eax, [Y]

Mov [Z], eax

Mov eax, [Y+4]

Mov [Z+4], eax

Jmp short m1

Mx:

Mov eax, [X]

Mov [X], eax

Mov eax, [X+4]

Mov [X+4], eax

M1:

3.

,

Addr1 dd

Addr2 dd

Len dd

1

Mov eax, [addr1]

Mov edx, eax

Add edx, [len]

Mov ebx, [addr2]

For1:

Mov cl, [eax]

Mov [ebx], cl

Inc eax

Inc ebx

Cmp eax, edx

Jle for1

!: Jle ! (Jbe).

! !

2

Ab = addr1; h = 1; Be = addr2;

If (addr2 != addr1){

If (addr2 > addr1 && addr2 < addr1+len){

Ab += len 1; Bb +=len 1;

H=-1;

}

for (i=0; i<len; i++){

*Bb = *Ab

bb+=h;

aa+=h;

}

;Ab = addr1; h = 1; Be = addr2;

mov eax, [addr1]

mov ebx, [addr2]

mov edx, 1

;If (addr2 != addr1){

cmp eax, ebx

je short break

; If (addr2 > addr1 && addr2 < addr1+len){

cmp eax, ebx

jbe m1

mov ecx, eax

add ecx, [len]

cmp ebx, ecx

jae m1

;Ab += len 1; Bb += len 1; H=-1;

mov eax, ecx

dec eax

add ebx, [len]

dec ebx

mov edx, -1

;}

;for (i=0; i<len; i++){ *Bb = *Ab; bb+=h; aa+=h;

mov esi, [len]

for2:

mov cl, [eax]

mov [ebx], cl

add eax, edx

add ebx, edx

sub esi, 1

jnz for2