Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. INCLUDE Irvine32.inc
  2.  
  3. .data
  4. myValue SDWORD ?
  5. prompt BYTE "Please enter a value:",0
  6. prompt2 BYTE "Please enter a value to search for:",0
  7. prompt3 BYTE "Error number not found",0
  8. prompt4 BYTE "Found the number: ",0
  9. prompt5 BYTE " at position: ",0
  10. prompt6 BYTE " ",0
  11. myarray DWORD 20 DUP(?)
  12.  
  13. .code
  14. main PROC
  15.  
  16.  
  17. mov ebx, 0
  18. mov ecx, 0
  19. begPrompt: lea edx,prompt
  20. call WriteString
  21. call ReadInt
  22. mov [myarray+ecx], eax
  23. add ecx, 4
  24. add ebx, 1
  25. cmp ebx, 20
  26. jl begPrompt
  27.  
  28.  
  29.  
  30.  
  31. mov eax, 0
  32. mov ebx, 0
  33. begloop: mov eax, [myarray+ebx]
  34. call WriteDec
  35. lea edx,prompt6
  36. call WriteString
  37. add ebx,4
  38. mov eax,0
  39. cmp ebx,40
  40. jl begloop
  41. call Crlf
  42.  
  43.  
  44.  
  45.  
  46. mov eax, 0
  47. beg2loop: mov eax, [myarray+ebx]
  48. call WriteDec
  49. lea edx,prompt6
  50. call WriteString
  51. add ebx,4
  52. mov eax,0
  53. cmp ebx,80
  54. jl beg2loop
  55.  
  56.  
  57.  
  58.  
  59.  
  60. mov eax, 0
  61. mov ebx, 0
  62. mov ecx, 0
  63. call Crlf
  64. lea edx,prompt2
  65. call WriteString
  66. call ReadInt
  67. mov ecx, eax
  68. mov eax, 0
  69. cmp ecx, 0
  70. jl negative
  71.  
  72.  
  73. beg3loop: mov eax, [myarray+ebx]
  74. cmp eax, ecx
  75. je exitloops
  76. add ebx,4
  77. cmp ebx,80
  78. jg error
  79. jmp beg3loop
  80.  
  81. call Crlf
  82.  
  83. error: lea edx,prompt3
  84. call WriteString
  85.  
  86. negative:
  87.  
  88. exitloops: lea edx,prompt4
  89. call WriteString
  90. call WriteDec
  91. lea edx,prompt5
  92. call WriteString
  93. mov eax,ebx
  94. mov ebx,4
  95. mov edx, 0
  96. div ebx
  97. add eax, 1
  98. call WriteDec
  99. call Crlf
  100.  
  101. exit
  102. main ENDP
  103. END main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement