Hello,
I've recently decided to use FASM for its ease of use and the power it has and I think in the past month or so of learning assembly I've finally raced out of the starting gate (If you will;) ). I just have one small question, I'd like to be able to process command line arguments through argc and argv and I assume that you'd put proc main argc,argv into the section '.text' data area, but where can I get the macro include file for Proc?
Thanks :)
I've recently decided to use FASM for its ease of use and the power it has and I think in the past month or so of learning assembly I've finally raced out of the starting gate (If you will;) ). I just have one small question, I'd like to be able to process command line arguments through argc and argv and I assume that you'd put proc main argc,argv into the section '.text' data area, but where can I get the macro include file for Proc?
Thanks :)
Its included with FASM , in the examples portion under win32. If you're using the PE format you can use the API function GetCommandLine.
One more thing, whenever I try to invoke a windows command it says "undefined symbol" in fasm, i put this in my file though:
include '%include%/win32as.inc'
include '%include%/win32as.inc'
It's possible you have the buggy version 1.43, because the first one I have uploaded had a two small bugs that caused problems similar to your. So please download the 1.43 once again and check whether you still get that error. If yes, please post your source here.
I don't think so, I just downloaded FASM yesterday and from what I saw in the fasm 1.43 thread the problem was fixed before then. Heres the basic jist of the code
Forgive me if I've made a completely unrelated to FASM assembly programming boo-boo :)
By the way what does the 4.0 in GUI 4.0 mean?I looked through the examples and noticed thats what they said so I naturally put 4.0 after GUI.
format PE GUI 4.0
entry start
include '%include%/WIN32AS.INC'
section '.text' code readable executable
start: xor eax,eax
jmp near exit
exit: invoke ExitProcess,0
Forgive me if I've made a completely unrelated to FASM assembly programming boo-boo :)
By the way what does the 4.0 in GUI 4.0 mean?I looked through the examples and noticed thats what they said so I naturally put 4.0 after GUI.
You have mixed two different styles of programming, because main includes from the win32inc package give you the different syntax. Here are the two correct variants you can choose:
4.0 is the subsystem version for the Win95 GUI, that means the executable will need at least Windows 95 to run. If you don't specify it, fasm will use default value 3.10, these executables can be run under old WinNT or Windows 3.11 with Win32s installed (but - if I recall correctly - you need to include fixups in the executable for Win32s).
include '%include%/WIN32AS.INC'
.code
start: xor eax,eax
jmp near exit
exit: invoke ExitProcess,0
.end start
format PE GUI 4.0
entry start
include '%include%\macro\stdcall.inc'
include '%include%\macro\import.inc'
;include '%include%\equatesa\kernel.inc'
;include '%include%\equatesa\user.inc'
section '.text' code readable executable
start: xor eax,eax
jmp near exit
exit: invoke ExitProcess,0
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL'
import kernel32,ExitProcess,'ExitProcess'
4.0 is the subsystem version for the Win95 GUI, that means the executable will need at least Windows 95 to run. If you don't specify it, fasm will use default value 3.10, these executables can be run under old WinNT or Windows 3.11 with Win32s installed (but - if I recall correctly - you need to include fixups in the executable for Win32s).
Thank you Privalov. I'll try this tomorrow and post if I have any more problems. Keep up the good work on a powerful great assembler!:)
kairon,
You can check also the thread:
http://www.asmcommunity.net/board/index.php?topic=9510&highlight=getmainargs
Regards,
Vortex
You can check also the thread:
http://www.asmcommunity.net/board/index.php?topic=9510&highlight=getmainargs
Regards,
Vortex