Advertisement
kerelius

Lab06_Task3

Oct 17th, 2019
2,400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .686
  2. .xmm
  3. .model flat, c
  4.  
  5. includelib libcmt.lib
  6. includelib libvcruntime.lib
  7. includelib libucrt.lib
  8. includelib legacy_stdio_definitions.lib  
  9.  
  10. extern printf_s : proc
  11.  
  12. .data
  13.     array    real8        5.0, 2.0,  3.0, 4.5, 7.2,
  14.                           8.3, 1.0, 12.4, 3.0, 6.6,
  15.                           4.0, 2.0,  3.0, 5.0, 9.0,
  16.                           3.0, 6.0,  8.0, 4.1, 3.0
  17.     count    dword        0
  18.     outputFormatString    byte      "The frequency of 3.0 = %d", 13, 10, 0
  19.     THREE    real8        3.0
  20. .const
  21.     numRows    equ    4
  22.     numCols    equ    5
  23.  
  24. .code
  25. main    proc
  26.     mov        ebx,     offset array
  27.     mov        ecx,     numRows
  28.     mov        edx,     type array * numCols
  29.     xor        eax,     eax
  30.     movsd      xmm1,    THREE
  31.     L1:
  32.         .while eax < numCols
  33.             movsd       xmm0,   real8 ptr [ebx + eax * 8]
  34.             comisd      xmm0,   xmm1
  35.             jne         NOT_EQUAL
  36.                 inc    count;
  37.             NOT_EQUAL:
  38.             inc    eax
  39.         .endw
  40.        
  41.         xor    eax,    eax
  42.         add    ebx,    edx
  43.    
  44.     loop L1    
  45.    
  46.     push    count
  47.     push    offset outputFormatString    
  48.     call    printf_s
  49.     add     esp,    8
  50.    
  51.     xor     eax, eax
  52.     ret
  53. main    endp
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement