x86汇编创建Win32可执行程序NASM [英] x86 assembly create Win32 executable NASM
问题描述
我想创建有效的Win32可执行程序,可以运行作为独立的应用程序。
例如,这个简单的程序:
32位
MOV EAX,1
RET
我就用NASM编译
NASM TEST.ASM -o TEST.EXE
然后我跑的程序。
它开始NTVDM它告诉我的NTVDM CPU遇到非法指令和一些技术细节,可能倾倒,和寄存器。
所以,我想创建装配language.I独立的Win32应用程序不希望创建COM文件,就像在DOS,
[第]的.text
全球_start
_开始:
MOV EAX,1
RET
可以组装这样的:
NASM -fwin32 file.asm(这应该给你file.obj)
和
链接/子系统:窗户/项:启动file.obj
(或)
LD -e _start file.obj
链接器无论你选择应该给你您的.exe
i want to create valid Win32 executable, that can be run as standalone application.
For example, this simple program:
bits 32
mov eax,1
ret
I compiled it using NASM with nasm test.asm -o test.exe Then i ran that program. It started NTVDM and it told me "The NTVDM CPU encountered illegal instruction" and some technical details, probably dump, and registers.
So, i want to create standalone Win32 application in assembly language.I don't want to create COM file, like in DOS,
[section] .text
global _start
_start:
mov eax, 1
ret
can be assembled like this:
nasm -fwin32 file.asm (this should give you file.obj)
and
link /subsystem:windows /entry:start file.obj
(or)
ld -e _start file.obj
whatever linker you choose should give you your .exe
这篇关于x86汇编创建Win32可执行程序NASM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!