私はアセンブリ言語の学習にWindows 7を使用しています。実行可能ファイルを作成するためのオブジェクトファイルとmingwの作成にNASMを使用しています。ファイルhello.exeファイルを実行している間Windows 7のnasmで実行可能な実行ファイルを実行できません
私は、使用している間
「ファイルhello.exeが働いて立ち止まった」を示すエラーメッセージが表示され、実行可能ファイル
del hello.o
del hello.exe
nasm -f elf hello.asm
ld hello.o -o hello.exe
hello
をコンパイルため、次のコマンドを使用して実行していますコマンド
nasm -f bin hello.asm -o program.exe
次私は
の下に表示されるエラーを持っているあなたはLinuxのコード(int 80
、sys_write
とsys_exit
ているカーネルのシステムではなく、低レベルのものを要求)がある持っているどのような私のプログラムコード
global _start ; global entry point export for ld
section .text
_start:
; sys_write(stdout, message, length)
mov eax, 4 ; sys_write syscall
mov ebx, 1 ; stdout
mov ecx, message ; message address
mov edx, length ; message string length
int 80h
; sys_exit(return_code)
mov eax, 1 ; sys_exit syscall
mov ebx, 0 ; return 0 (success)
int 80h
section .data
message: db 'Hello, world!',0x0A ; message and newline
length: equ $-message ; NASM definition pseudo-instruction
私たちにコードを教えてください。 – paxdiablo
私のシステムのタイプ:32bit os –