Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. .586
  2.  
  3. .model flat, stdcall
  4. option casemap:none
  5.  
  6. include \masm32\include\windows.inc
  7. include \masm32\include\kernel32.inc
  8. include \masm32\include\masm32.inc
  9. include \masm32\include\debug.inc
  10. include \masm32\include\user32.inc
  11.  
  12.  
  13. includelib \masm32\lib\kernel32.lib
  14. includelib \masm32\lib\masm32.lib
  15. includelib \masm32\lib\debug.lib
  16. includelib \masm32\lib\user32.lib
  17.  
  18. .data
  19. arr dd 1, 2, 3, -4, 5
  20. l dd 3
  21. s dd 5
  22. sum dd 0
  23.  
  24. .code
  25. start:
  26. mov ecx, l
  27. xor eax, eax
  28.  
  29. next:
  30. mov ebx, [arr+ecx*4 - 4]
  31. cmp ebx, 0
  32. jle increment
  33.  
  34. summ:
  35. add eax, [arr+ecx*4 - 4]
  36. increment:
  37. inc ecx
  38. cmp ecx, s
  39.  
  40. jle next
  41.  
  42. mov sum, eax
  43. PrintDec sum
  44.  
  45. invoke ExitProcess, NULL
  46. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement