Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SquareRoot PROC
  2.     push ebp
  3.     mov ebp, esp
  4.     mov EAX, [EBP + 8]
  5.     push EBX
  6.     push ECX
  7.  
  8.     mov ECX, 0
  9.     mov EBX, 1
  10.    calculate_root:
  11.       sub EAX, EBX
  12.       add ECX, 1
  13.       add EBX, 2
  14.       cmp EAX, 0
  15.    jne  calculate_root
  16.    mov [EBP+12], ECX
  17.    pop ECX
  18.    pop EBX
  19.    
  20.    pop EBP
  21.    
  22.    RET 4
  23. SquareRoot ENDP
  24.  
  25. start:
  26.       mov ESI, 0
  27. begin:
  28.       lea EBX, array
  29.  
  30.       mov EDX, [EBX][ESI] ; move next item in the array
  31.  
  32.       push EDX
  33.       invoke  crt_printf,addr PrintOriginal, EDX    ; printf()
  34.       pop EDX
  35.       mov EAX, EDX
  36.       push EDX
  37.       push EAX
  38.       call SquareRoot
  39.       pop EAX
  40.  
  41.       invoke crt_printf, addr PrintRoot, EAX   ; printf()
  42.  
  43.      
  44.       add ESI, 4
  45.       cmp ESI, 20
  46.       jb begin
  47.  
  48.       invoke  crt__getch                          ; getch()
  49.       ret
  50. end         start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement