Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .686
- .MODEL FLAT, C
- .STACK
- .DATA
- ;-----------Local data------------------------------
- .CODE
- ;-----------External usage--------------------------
- ;-----------Function definitions--------------------
- MAS_FUNC PROC C numRanDat:dword, NInt:dword, randInt:dword, LGrInt:dword, numInInter:dword, median:dword
- mov ecx, 0
- mov ebx, [randInt]
- mov esi, [LGrInt]
- mov edi, [numInInter]
- startf:
- cmp ecx, numRanDat
- je med
- mov eax, [ebx]
- inc ecx
- mov edx, 0
- push ecx
- compar:
- inc edx
- cmp edx, NInt
- je countInter
- mov ecx, edx
- shl ecx, 2
- cmp eax, [esi+ecx]
- jge compar
- countInter:
- pop ecx
- dec edx
- shl edx, 2
- push eax
- mov eax, [edi+edx]
- inc eax
- mov [edi+edx], eax
- pop eax
- add ebx, 4
- jmp startf
- med:
- mov ecx, -1
- mov edi, [randInt]
- puzirek:
- mov eax, numRanDat
- dec eax
- inc ecx
- mov edx, ecx
- inc edx
- cmp ecx, eax
- je exit
- puzirek2:
- cmp edx, numRanDat
- je puzirek
- mov eax, [edi+ecx*4]
- mov ebx, [edi+edx*4]
- cmp eax, ebx
- jle ravno
- mov [edi+ecx*4], ebx
- mov [edi+edx*4], eax
- ravno:
- inc edx
- jmp puzirek2
- exit:
- mov ecx, 1
- mov edx, [randInt]
- mov esi, [median]
- mov edi, [numInInter]
- mov eax, 0
- mov ebx, [edi]
- cmp ebx, 0
- je nullcount1
- push eax
- push edx
- push ecx
- mov ecx, 2
- mov edx, 0
- mov eax, ebx
- idiv ecx
- cmp edx, 0
- je minus2
- zero1:
- shr ebx, 1
- push eax
- mov eax, [edx+ebx*4]
- mov [esi], eax
- pop eax
- exit2:
- cmp ecx, NInt
- je final
- mov ebx, [edi+ecx*4]
- cmp ebx, 0
- je nullcount
- dec ecx
- add eax, [edi+ecx*4]
- inc ecx
- push eax
- push edx
- push ecx
- mov ecx, 2
- mov edx, 0
- mov eax, ebx
- idiv ecx
- cmp edx, 0
- je minus
- exit3:
- pop ecx
- pop edx
- pop eax
- shr ebx, 1
- add ebx, eax
- push eax
- mov eax, [edx+ebx*4]
- mov [esi+ecx*4], eax
- pop eax
- inc ecx
- jmp exit2
- minus:
- dec ebx
- jmp exit3
- minus2:
- dec ebx
- jmp zero1
- nullcount:
- push eax
- mov eax, 0
- mov [esi+ecx*4], eax
- inc ecx
- pop eax
- jmp exit2
- nullcount1:
- push eax
- mov eax, 0
- mov [esi], eax
- inc ecx
- pop eax
- jmp exit2
- final:
- ret
- MAS_FUNC ENDP
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement