General > Chit-Chat
need a sample for x86 assembly file and compile and linking syntax..Appriciated
(1/1)
sydhsnazm:
need a sample for x86 assembly file and compile and linking syntax..Appriciated
e.g.
<------------------------------------>
.386
.model flat, stdcall
option casemap : none
.code
start:
;write your code here
xor eax, eax
mov eax,6H
ret
end start
<------------------------------------------->
above file is for masm x86 and compile syntax is as follows ,remove square brackets please.
ml.exe /nologo /Sn /Sa /c /coff /Fo[PROGRAM_NAME.OBJ] /Fl[LSTOUTPUT_NAME.LST] [PROGRAM_NAME.ASM]
and linking is as follows ,remove square brackets please.
link.exe /SUBSYSTEM:CONSOLE /OPT:NOREF /NOLOGO /OUT:[PROGRAM_NAME.EXE] [PROGRAM_NAME.OBJ]
thanks in advance.
Vortex:
Hi sydhsnazm,
Welcome to the Pelles C forum. You would like to use Pelle's Macro Assembler Poasm which has very similar syntax to that of Masm.
--- Code: ---.386
.model flat,stdcall
option casemap:none
ExitProcess PROTO :DWORD
MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD
MessageBox TEXTEQU <MessageBoxA>
includelib kernel32.lib
includelib user32.lib
MB_OK equ 0
.data
msg db 'Hello world!',0
capt db 'Message box',0
.code
start:
invoke MessageBox,0,ADDR msg,ADDR capt,MB_OK
invoke ExitProcess,0
END start
--- End code ---
Assembling the code :
--- Code: ---\PellesC\bin\poasm /AIA32 Hello.asm
\PellesC\bin\polink /SUBSYSTEM:WINDOWS /LIBPATH:\PellesC\Lib\Win Hello.obj
--- End code ---
Navigation
[0] Message Index
Go to full version