kerelius

Lab06_Task2

Oct 14th, 2019
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. includelib libcmt.lib
  2. includelib libvcruntime.lib
  3. includelib libucrt.lib
  4. includelib legacy_stdio_definitions.lib  
  5.  
  6. extern printf_s: proc, scanf_s : proc
  7.  
  8. .data
  9.     array       dword   5, 2, 3, 4, 7, 8, 1, 12
  10.     arraySize = ($ - array)/4    ;    8
  11.     count   dword   0
  12.  
  13. .data?
  14.     k   dword   ?
  15.  
  16. .code
  17. main    proc
  18.     enter   32,0
  19.     mov  rcx,  0 ; i = 0
  20.     mov  rsi,  array
  21.    
  22.     loop1:  
  23.         CMP  rcx,  arraySize
  24.         JAE  END_FOR
  25.        
  26.         mov  rax,    [rsi + rcx * 4]
  27.         cqo
  28.         mov  rbx, 2
  29.         div  rbx
  30.        
  31.         cmp  rdx, 0
  32.         jne  end_if
  33.         inc  count
  34.         end_if:
  35.  
  36.         inc  rcx
  37.         jmp  loop1
  38.     end_for:
  39.  
  40.  
  41.  
  42.  
  43.  
  44.     leave
  45.     xor rax, rax
  46. main    endp
  47. end
Add Comment
Please, Sign In to add comment