Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void copyArr(int* a, int* b, int n)
- {
- int sizeEl;
- int space;
- __asm
- {
- mov sizeEl, type a // размер элемента
- mov eax, b // eax = b
- sub eax, a // eax = b - a
- mov space, eax // смещение
- mov eax, n // eax = n
- dec eax // eax = n - 1
- mov ecx, eax // ecx = n - 1
- mov ebx, a // база
- // b[i] = <база> + <множитель> * <индекс> + <смещение>
- // b[i] = a[ebx + sizeEl*ecx + space]
- L :
- mov eax, ecx // eax = ecx
- mul sizeEl // eax = ecx * sizeEl
- add eax, ebx // eax = ebx +
- mov edx, [eax] // edx = a[ecx]
- add eax, space // memory of b[i] = ebx + sizeEl*ecx + space
- mov [eax], edx // b[ecx] = a[ecx]
- dec ecx // ecx --
- cmp ecx, 0 // ecx >= 0 ? L : exit
- JGE L
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement