flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution
There is an MSCOFF.ASM example file in the download:
Code: ; example of making Win32 COFF object file format MS COFF extrn '__imp__MessageBoxA@16' as MessageBox:dword section '.text' code readable executable public _demo _demo: push 0 push _caption push _message push 0 call [MessageBox] ret section '.data' data readable writeable _caption db 'Win32 assembly',0 _message db 'Coffee time!',0 |
|||
![]() |
|
Manos
I know the above example.
But instead of: extrn '__imp__MessageBoxA@16' as MessageBox:dword I want to use: include 'C:\Fasm\INCLUDE\win32ax.inc' and instead of pushing the parameters on the stack and calling the function, I want to use: invoke MessageBox, etc, just like MASM projects. Manos. |
|||
![]() |
|
revolution
You don't need to include the entire win32 set. Just this might be all you need:
Code: include 'macro/proc32.inc' |
|||
![]() |
|
Manos
revolution wrote: You don't need to include the entire win32 set. Just this might be all you need: It is not enough. Try to assemble the following code: format MS COFF include 'C:\Fasm\INCLUDE\win32ax.inc' .code start: invoke MessageBox,HWND_DESKTOP,"Hi! I'm the example program!",0,MB_OK invoke ExitProcess,0 .end start Manos. |
|||
![]() |
|
revolution
You don't need ".end" with COFF. The linker will set the entry address. And don't use win32ax, try the include I posted above.
Code: format MS COFF include 'macro/proc32.inc' extrn '__imp__MessageBoxA@16' as MessageBox:dword section '.text' code readable executable public MyCode MyCode: invoke MessageBox,0,caption,message,0 ret section '.data' data readable writeable caption db 'Win32 assembly',0 message db 'Coffee time!',0 |
|||
![]() |
|
Manos
Hi revolution.
I know your above example. But because I am building an IDE for plain C, MASM and FASM, I would like to avoid the: extrn '__imp__MessageBoxA@16' as MessageBox:dword. I want to use: 'C:\Fasm\INCLUDE\win32ax.inc', like I do in MASM. Manos. |
|||
![]() |
|
revolution
win32ax won't work for you. You will need to write some type of macro or include file to create all the import names. You will need the extrn's to be included somewhere in the source that fasm sees. Currently there is no file that will do that for you in the fasm download.
|
|||
![]() |
|
Manos
Yes, you are right.
I have to implement my own include files. Thank you for your replies, Manos. |
|||
![]() |
|
Manos
In NASM there is the expression: times ($$-$) & 3 nop
How can I phrase the above in FASM ? Thanks, Manos. |
|||
![]() |
|
revolution
Replace & with and
|
|||
![]() |
|
Manos
revolution wrote: Replace & with Thang you, it is correct, but I have also to replace the: $$-$ with: $-$$ The correct is: times ($-$$) and 3 nop Manos. |
|||
![]() |
|
revolution
Manos wrote: The correct is: times ($-$$) and 3 nop Code: align 4 Last edited by revolution on 22 Nov 2016, 13:38; edited 1 time in total |
|||
![]() |
|
Manos
revolution wrote:
I thought to use: align 4, but I prefer to avoid macros, because my C compiler can emit plain FASM code. My C compiler, (wcc32), accepts also inline assembly. Because my IDE use wcc32, I wish my IDE to mix C and assembly modules. I have implemented, also a linker, named wlink32 and a RC compiler, but I have upload only wlink32 for now. Have a look there: http://www.manoscoder.gr/w32cc/viewtopic.php?f=12&t=24 Thank you, Manos. |
|||
![]() |
|
revolution
Align is not a macro in fasm.
|
|||
![]() |
|
Manos
OK.
I 'll test this later. Manos. |
|||
![]() |
|
revolution
Oh wait. $-$$ gives you the offset. I think that $$-$ is what you wanted, the negative offset.
|
|||
![]() |
|
Manos
revolution wrote: Oh wait. $-$$ gives you the offset. I think that $$-$ is what you wanted, the negative offset. The first worked fine. I 'll test for the $$-$ Manos. |
|||
![]() |
|
revolution
Manos wrote:
|
|||
![]() |
|
Manos
revolution wrote:
Yes, you are right. I tested the: $$-$ and it works OK also. Finally, I 'll use the: $$-$ Thank you again. P.S. Did you download my wlink32 ? Manos. |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.