Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;wine ml.exe -c -coff % && wine link.exe /subsystem:windows %<.obj && wine %<.exe
- .686
- .model flat,stdcall
- include c:\masm32\include\kernel32.inc
- includelib c:\masm32\lib\kernel32.lib
- include c:\masm32\include\user32.inc
- includelib c:\masm32\lib\user32.lib
- .data
- massiv dd 4,1,4,9,1,6,28
- len equ $-massiv
- MsgTitle db 'Результат',0
- Msg db 'Кол-во элементов > среднего ариф.: '
- res db 20 dup(0)
- szformat db "%u", 0
- .code
- jmp start
- compute proc ; DWORD sred(DWORD* massiv, DWORD size)
- mov ebx, dword ptr [esp+4]
- mov ecx, dword ptr [esp+8]
- mov eax, ecx
- xor esi, esi
- jmp summa
- tmp:
- dec eax
- add esi, dword ptr [ebx+eax*4]
- summa:
- or eax, eax
- jnz tmp
- ;srednee
- mov eax, esi
- xor edx, edx
- div ecx
- mov esi, eax
- xor eax, eax
- jmp tmp2
- otvet:
- dec ecx
- cmp esi, dword ptr [ebx+ecx*4]
- adc eax, 0
- tmp2:
- or ecx, ecx
- jnz otvet
- ret 8
- compute endp
- start:
- push len/4
- push offset massiv
- call compute
- invoke wsprintf, offset res, offset szformat, eax
- invoke MessageBoxA,0,offset Msg,offset MsgTitle,0
- invoke ExitProcess, 0
- end start
Add Comment
Please, Sign In to add comment