flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Core i7 03 Jun 2025, 00:57
Code: format pe64 console include 'win64ax.inc' entry start section '.data' data readable writeable val dq 42.78 section '.text' code readable executable start: sub rsp,8 ;<-------------- movsd xmm0, [val] cinvoke printf,<' DEBUG float = %.6f',0>,[val] cinvoke _getch cinvoke exit,0 section '.idata' import data readable writeable library msvcrt,'msvcrt.dll' import msvcrt, printf,'printf', _getch,'_getch', exit,'exit' |
|||
![]() |
|
xddj 03 Jun 2025, 01:14
Thank you, it works perfectly! I had spent days trying to get this to work in pure FASM PE64 (manual stack alignment, direct calls to printf, etc.) and always got 0.0. I didn't realize that the advanced macros in `win64ax.inc` handle all the x64 calling convention/stack tricks behind the scenes.
Your example and explanation made it clear. This will definitely help anyone else facing the same issue! Much appreciated! |
|||
![]() |
|
revolution 03 Jun 2025, 01:36
Better to use push rbp. No need for the longer, and less compatible, sub rsp,8.
|
|||
![]() |
|
xddj 03 Jun 2025, 01:41
Thanks for the advice! I didn’t realize that `push rbp` was the preferred and more compatible way to align the stack. I’ll update my code accordingly. Much appreciated!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.