Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. .686
  2. .MODEL FLAT, C
  3. .STACK
  4. .DATA
  5. ;-----------Local data------------------------------
  6. .CODE
  7. ;-----------External usage--------------------------
  8. ;-----------Function definitions--------------------
  9. MAS_FUNC PROC C numRanDat:dword, NInt:dword, randInt:dword, LGrInt:dword, numInInter:dword, median:dword
  10. mov ecx, 0
  11. mov ebx, [randInt]
  12. mov esi, [LGrInt]
  13. mov edi, [numInInter]
  14. startf:
  15. cmp ecx, numRanDat
  16. je med
  17. mov eax, [ebx]
  18. inc ecx
  19. mov edx, 0
  20. push ecx
  21. compar:
  22. inc edx
  23. cmp edx, NInt
  24. je countInter
  25. mov ecx, edx
  26. shl ecx, 2
  27. cmp eax, [esi+ecx]
  28. jge compar
  29. countInter:
  30. pop ecx
  31. dec edx
  32. shl edx, 2
  33. push eax
  34. mov eax, [edi+edx]
  35. inc eax
  36. mov [edi+edx], eax
  37. pop eax
  38. add ebx, 4
  39. jmp startf
  40. med:
  41. mov ecx, -1
  42. mov edi, [randInt]
  43. puzirek:
  44. mov eax, numRanDat
  45. dec eax
  46. inc ecx
  47. mov edx, ecx
  48. inc edx
  49. cmp ecx, eax
  50. je exit
  51. puzirek2:
  52. cmp edx, numRanDat
  53. je puzirek
  54. mov eax, [edi+ecx*4]
  55. mov ebx, [edi+edx*4]
  56. cmp eax, ebx
  57. jle ravno
  58. mov [edi+ecx*4], ebx
  59. mov [edi+edx*4], eax
  60. ravno:
  61. inc edx
  62. jmp puzirek2
  63. exit:
  64. mov ecx, 1
  65. mov edx, [randInt]
  66. mov esi, [median]
  67. mov edi, [numInInter]
  68. mov eax, 0
  69. mov ebx, [edi]
  70. cmp ebx, 0
  71. je nullcount1
  72. push eax
  73. push edx
  74. push ecx
  75. mov ecx, 2
  76. mov edx, 0
  77. mov eax, ebx
  78. idiv ecx
  79. cmp edx, 0
  80. je minus2
  81. zero1:
  82. shr ebx, 1
  83. push eax
  84. mov eax, [edx+ebx*4]
  85. mov [esi], eax
  86. pop eax
  87. exit2:
  88. cmp ecx, NInt
  89. je final
  90. mov ebx, [edi+ecx*4]
  91. cmp ebx, 0
  92. je nullcount
  93. dec ecx
  94. add eax, [edi+ecx*4]
  95. inc ecx
  96. push eax
  97. push edx
  98. push ecx
  99. mov ecx, 2
  100. mov edx, 0
  101. mov eax, ebx
  102. idiv ecx
  103. cmp edx, 0
  104. je minus
  105. exit3:
  106. pop ecx
  107. pop edx
  108. pop eax
  109. shr ebx, 1
  110. add ebx, eax
  111. push eax
  112. mov eax, [edx+ebx*4]
  113. mov [esi+ecx*4], eax
  114. pop eax
  115. inc ecx
  116. jmp exit2
  117. minus:
  118. dec ebx
  119. jmp exit3
  120. minus2:
  121. dec ebx
  122. jmp zero1
  123. nullcount:
  124. push eax
  125. mov eax, 0
  126. mov [esi+ecx*4], eax
  127. inc ecx
  128. pop eax
  129. jmp exit2
  130. nullcount1:
  131. push eax
  132. mov eax, 0
  133. mov [esi], eax
  134. inc ecx
  135. pop eax
  136. jmp exit2
  137. final:
  138. ret
  139. MAS_FUNC ENDP
  140. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement