Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .386
  2. .model flat, c
  3.  
  4. public  p01
  5.  
  6. .code
  7.  
  8. p01     proc
  9.  
  10.         push    ebp
  11.         mov     ebp, esp
  12.         push    edi
  13.         push    esi
  14.         push    ebx
  15.  
  16.         mov     ecx, [ebp + 12] ; ecx - matrix len
  17.         mov     ebx, [ebp + 8] ; ebx - matrix adress
  18.  
  19.         mov     eax, 0 ; nill
  20.         mov     edx, ecx ; edx - matrix len2
  21.         add     ebx, edx ; offset to [1] string [0] index
  22.         dec     ecx ; ecx = 4
  23.  
  24.         M1:
  25.                 mov     edi, 0
  26.                 mov     esi, ecx ; esi = 4;
  27.                 mov     ecx, edx ; ecx = 5;
  28.                 sub     ecx, esi ; how many fields in  string i need to check
  29.  
  30.                 M2:
  31.                         test    byte ptr [ebx + edi], 1 ; if even => flag zf = 1;
  32.                         jz      SKIP_INC ; if zf == 1;
  33.                         inc     eax
  34.  
  35.                 SKIP_INC:
  36.  
  37.                         inc     edi
  38.                         loop    M2
  39.  
  40.                 mov     ecx, esi ; ecx = 4 for loop m1
  41.                 add     ebx, edx ; to new string
  42.                 loop    M1
  43.        
  44.         mov     edi, [ebp + 16]
  45.         mov     dword ptr [edi], eax
  46.  
  47.         pop     ebx
  48.         pop     esi
  49.         pop     esi
  50.         pop     ebp
  51.  
  52.         ret
  53. p01     endp
  54.  
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement