SHARE
TWEET

insufficient numbers

Dari_ Mar 31st, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %include "io.inc"
  2.  
  3. section .data
  4.     n dd 0
  5.     count dd 1
  6.     num dd 1
  7.  
  8. section .text
  9.  
  10. FUNC:
  11.     push ebp
  12.     mov ebp, esp
  13.    
  14.     .cont1:
  15.     mov eax, [ebp + 8]
  16.     mov edx, [ebp + 16]
  17.     cmp eax, edx
  18.     je .end2
  19.    
  20.     mov eax, [ebp + 8]
  21.     mov ecx, [ebp + 16]
  22.     cdq
  23.     div ecx
  24.     cmp edx, 0
  25.     jne .end3
  26.     mov eax, [ebp + 12]
  27.     add eax, ecx
  28.     mov [ebp + 12], eax
  29.     .end3:
  30.    
  31.     mov edx, [ebp + 16]
  32.     inc edx
  33.     mov [ebp + 16], edx
  34.     jmp .cont1
  35.     .end2:
  36.    
  37.     mov eax, [ebp + 12]
  38.     mov esp, ebp
  39.     pop ebp
  40.     ret
  41.  
  42. global CMAIN
  43. CMAIN:
  44.     GET_DEC 4, [n]
  45.     .back1:
  46.     mov ecx, dword[count]
  47.     cmp ecx, dword[n]
  48.     je .end1
  49.     mov ecx, dword[num]
  50.     inc ecx
  51.     mov dword[num], ecx
  52.    
  53.     push ebp
  54.     mov ebp, esp
  55.     sub esp, 12
  56.     mov [esp], ecx
  57.     mov ecx, 1
  58.     mov [esp + 4], ecx
  59.     mov ecx, 2
  60.     mov [esp + 8], ecx
  61.     call FUNC
  62.     mov esp, ebp
  63.     pop ebp
  64.    
  65.     cmp eax, dword[num]
  66.     jge .not
  67.     mov ecx, dword[count]
  68.     inc ecx
  69.     mov dword[count], ecx
  70.     .not:
  71.     jmp .back1
  72.     .end1:
  73.     PRINT_DEC 4, num
  74.    
  75.     xor eax, eax
  76.     ret
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top