Advertisement
kerelius

Untitled

Sep 16th, 2019
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. includelib libcmt.lib
  2. includelib libvcruntime.lib
  3. includelib libucrt.lib
  4. includelib legacy_stdio_definitions.lib
  5.  
  6. extern scanf_s: proc, printf_s: proc
  7.  
  8. .data
  9. inputFormatString byte "%le", 0
  10. outputFormatString byte "Charge2 = %e Coulombs", 13, 10, 0
  11. promptMsg byte "Enter the charge q1 [in Coulumbs]: ", 0
  12. K real8 8.9875e9
  13. distance real8 0.004
  14. F real8 1.999438e-2
  15. .data?
  16. q1 real8 ?
  17. q2 real8 ?
  18. .code
  19. main proc
  20.  
  21. enter 32, 0
  22.  
  23. lea rcx, promptMsg ; scanf_s("%d", &num); ;
  24. call printf_s
  25.  
  26. lea rcx, q1
  27. call scanf_s
  28.  
  29. movsd distance, xmm0
  30. mulsd xmm0, distance
  31. mulsd xmm0, F
  32. movsd xmm1, K
  33. mulsd xmm1, q1
  34. divsd xmm0, xmm1
  35. movsd q2, xmm0
  36.  
  37. lea rdx, q1
  38. lea rcx, outputFormatString
  39. call printf_s
  40.  
  41. ;(r * r) * F / K * q1 = q2
  42.  
  43.  
  44.  
  45. leave
  46.  
  47. xor rax, rax
  48. ret
  49. main endp
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement