Steward
分享是一種喜悅、更是一種幸福
程式語言 - Flat Assembler (FASM) - Assembly (x86) - Hello, world!(printf)
參考資訊:
https://board.flatassembler.net/index.php
https://tldp.org/HOWTO/Assembly-HOWTO/hello.html
https://chromium.googlesource.com/chromiumos/docs/+/HEAD/constants/syscalls.md
main.S
format elf
public main
extrn printf
section ".data"
msg DB "Hello, world!", 10, 0
section ".text"
main:
push ebp
mov ebp, esp
push msg
call printf
xor eax, eax
mov esp, ebp
pop ebp
ret
編譯、執行
$ fasm main.S main.o
$ gcc -m32 main.o -o main -static
$ ./main
Hello, world!