flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
ramguru 21 Jul 2009, 12:33
I doubt there will be anyone interested :> but I made my own macros that replace: proc,endp,ret,invoke,local. Of course they aren't universal, but do the job. So now proc looks like this:
proc WindowProc,12, hwnd,umsg,wparam,lparam localz buf[32]:BYTE, sz:SIZE 12 denotes that inside WindowProc there is procedure that requires 12 parameters, also my proc macro only supports parameters of default QWORD size ![]() ![]() So now hwnd,umsg,wparam,lparam are references using rsp the way it should be ![]() And I couldn't find a solution to use same parameter / local var. names among procedures. But hey I'm happy with what I did, and impressed .. how I can change behaviour of assembler :}
|
|||||||||||
![]() |
|
Tomasz Grysztar 23 Jul 2009, 22:49
Here comes the new version of "fastcall" macro, with full support for "addr" and inline strings (yes, I've decided the standard Win64 headers will support it, and the extended headers may just add the nested calling, if I implement it), and also additional "float" keyword.
The "addr" keyword works as usual, generating the LEA instruction. In 64-bit world this can be useful even for global variables: Code: invoke GetCursorPos pt ; uses MOV RCX with absolute address invoke GetCursorPos addr pt ; uses LEA RCX with RIP-relative address The inline strings work as usual (there's an issue with alignment, I'll get fixed when I release full package with the new set of includes): Code: invoke MessageBox,HWND_DESKTOP,"Hi! I'm an example of inline string!","Win64 Assembly",MB_OK And the "float" keyword allows to specify, that the given argument is a floating-point value (as the fastcall conventions requires them to be passed in XMM registers instead of GPRs): Code: invoke glColor3f,float dword 0.1,float dword 0.1,float dword 1.0 ; single precision values invoke glVertex3d,float 0.6,float 0.6,float 0.0 ; double precision values Also some other fixes in the fastcall macro have been applied. Please check it out!
|
|||||||||||
![]() |
|
ramguru 23 Jul 2009, 23:39
impressive work (thumbsup)
wonder how is it going with ... moving proc & local from rbp to rsp based .. if that's even on todo list :} Last edited by ramguru on 24 Jul 2009, 07:56; edited 1 time in total |
|||
![]() |
|
bitRAKE 24 Jul 2009, 02:22
It is getting quite featureful. Only possible problem I can think of atm is dqword alignment.
|
|||
![]() |
|
Tomasz Grysztar 24 Jul 2009, 07:46
bitRAKE wrote: Only possible problem I can think of atm is dqword alignment. With extended header I may modify ".end" macro to do this one automatically as well, though I'm not sure if it's a good idea. |
|||
![]() |
|
Tomasz Grysztar 24 Jul 2009, 12:24
Well, I decided to make this into ".end" macro, because it allows the new HELLO example to look like this:
Code: ; example of simplified Windows programming using complex macro features include 'win64wx.inc' ; you can simply switch between win32ax, win32wx, win64ax and win64wx here .code start: invoke MessageBox,HWND_DESKTOP,"Hi! I'm the example program!",invoke GetCommandLine,MB_OK invoke ExitProcess,0 .end start I've updated the fasmw 1.69.02 package with the new includes and examples. There's a 64-bit version of OpenGL example added, which demonstrates usage of "frame" and "float" features. Note that those macros may still be buggy, so in case you are getting any problems with them, you may want to revert to the old ones from 1.68 package. For instance, I just had to remove the stack movements merging feature, because I didn't take into consideration that it's possible to jump in between the merged calls. But you still have the "frame" macro to optimize the RSP movements a bit. |
|||
![]() |
|
Tomasz Grysztar 03 Aug 2009, 10:20
With another update, the win64axp and win64wxp headers come as well, so now you have equivalents of all Win32 headers for the 64-bit world, too.
As for the RSP-based locals, please check out this new thread about "proc" customization: http://board.flatassembler.net/topic.php?p=98814#98814 |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.