Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int arrLen = 5;
- int arr[arrLen] = { 5,5,4,3,1 };
- int c;
- int i;
- __asm
- {
- mov ecx, arrLen
- xor eax, eax; max val
- xor esi, esi; max pos
- xor ebx, ebx; min val
- xor edi, edi; min pos
- mov eax, arr[ecx * 4 - 4]
- mov edi, ecx
- mov ebx, arr[ecx * 4 - 4]
- mov esi, ecx
- beg :
- cmp eax, arr[ecx * 4 - 4];
- jg maxchange
- cmp ebx, arr[ecx * 4 - 4];
- jle minchange
- cont:
- loop beg
- jmp endf
- maxchange:
- mov eax, arr[ecx * 4 - 4]
- mov esi, ecx
- jmp cont
- minchange:
- mov ebx, arr[ecx * 4 - 4]
- mov edi, ecx
- jmp cont
- endf:
- sub ebx, eax
- mov c, ebx
- sub edi, esi
- js nominus
- jmp endP
- nominus:
- neg edi
- endP:
- mov i,edi
- }
- cout << c;
- cout << i;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement