Advertisement
Orrin19

FASM

Sep 15th, 2023
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. ; Z = -X * (1 - X * Y)
  2. format PE Console
  3. entry start
  4. include 'win32a.inc'
  5.  
  6. section '.const' data readable
  7. x dd 2
  8. y dd 2
  9.  
  10. section '.data' data readable writeable
  11. z dd 0
  12. stringFormat db "Result: %d", 0
  13.  
  14. section '.code' code readable executable
  15. start:
  16. mov eax, [x]
  17. imul eax, [y]
  18. mov [z], eax
  19. mov eax, 1
  20. sub eax, [z]
  21. imul eax, [x]
  22. imul eax, -1
  23. mov [z], eax
  24.  
  25. invoke printf, stringFormat, [z]
  26. invoke getch
  27. invoke ExitProcess, 0
  28.  
  29. section '.idata' data import readable
  30. library kernel, 'kernel32.dll',\
  31. msvcrt, 'msvcrt.dll'
  32. import kernel, ExitProcess, 'ExitProcess'
  33. import msvcrt,\
  34. printf, 'printf',\
  35. getch, '_getch'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement