Advertisement
mcmikecreations

floattest.asm

Apr 7th, 2019
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. format PE console
  2. entry main
  3.  
  4. include 'd:/Projects/Assembler/SALO/SALO Compiler/INCLUDE/win32amacro.inc'
  5.  
  6. section '.text' code readable executable
  7.  
  8. ; peretvoryuvane : lpcstr as dword ptr ebp+8
  9. lpcstrvptr:
  10. push ebp
  11. mov ebp, esp
  12. ;native
  13.  
  14. mov eax, dword ptr ebp+8
  15.  
  16. mov esp, ebp
  17. pop ebp
  18. ret
  19.  
  20. ; znachennya : float32 as dword ptr ebp+8
  21. lyapnutyfloat32:
  22. push ebp
  23. mov ebp, esp
  24. sub esp, 16
  25. ;expression printstr ( "" )
  26. push lpcstr3
  27. call [printstr]
  28. add esp, 4
  29. ;local void_ptr variable k at dword ptr ebp-4
  30. ;expression k = lpcstrvptr ( "%f" )
  31. push lpcstr4
  32. call lpcstrvptr
  33. add esp, 4
  34. mov dword ptr ebp-4, eax
  35. ;native
  36.  
  37. movss xmm0, dword ptr ebp+8
  38. cvtss2sd xmm0, xmm0
  39. sub esp, 8
  40. movsd qword ptr esp, xmm0
  41. push dword ptr ebp-4
  42. call printstr
  43. add esp, 12
  44.  
  45. mov esp, ebp
  46. pop ebp
  47. ret
  48.  
  49. ; : void as dword ptr ebp+8
  50. main:
  51. push ebp
  52. mov ebp, esp
  53. sub esp, 16
  54. ;local float32 variable a at dword ptr ebp-4
  55. ;expression a = 7.0
  56. mov dword ptr ebp-4, 7.0
  57. ;local float32 variable b at dword ptr ebp-8
  58. ;expression b = 5.0
  59. mov dword ptr ebp-8, 5.0
  60. ;local float32 variable v at dword ptr ebp-12
  61. ;expression v = a + b
  62. movss xmm0, dword ptr ebp-4
  63. addss xmm0, dword ptr ebp-8
  64. movd dword ptr ebp-12, xmm0
  65. ;expression lyapnutyfloat32 ( v )
  66. push dword ptr ebp-12
  67. call lyapnutyfloat32
  68. add esp, 4
  69. ;expression return 0
  70. mov eax, 0
  71. mov esp, ebp
  72. pop ebp
  73. invoke ExitProcess, eax
  74.  
  75.  
  76. section '.data' data readable writeable
  77. lpcstr3 db 0
  78. lpcstr4 db "%f",0
  79.  
  80. section '.idata' data import readable
  81. library kernel32,'kernel32.dll',\
  82. msvcrt,'msvcrt.dll'
  83.  
  84. import kernel32,\
  85. ExitProcess,'ExitProcess',\
  86. SetConsoleCP,'SetConsoleCP',\
  87. SetConsoleOutputCP,'SetConsoleOutputCP'
  88.  
  89. import msvcrt,\
  90. scanint32,'scanf',\
  91. printint32,'printf',\
  92. printstr,'printf'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement