hello.s
.section .rodata
str: .ascii "Hello,world!\n"
.section .text
.globl _start
_start:
movl $4,%eax
movl $1,%ebx
movl $str,%ecx
movl $13,%edx
int $0x80
movl $1,%eax
movl $0,%ebx
int $0x80
makefile文件:
hello:hello.o
ld hello.o -o hello
hello.o:hello.s
as hello.s -o hello.o
clean:
rm hello.o hello

本文介绍了一个简单的汇编语言程序,用于输出'Hello, world!'。通过解析.asm源文件,展示了如何使用mov指令进行寄存器操作,以及如何调用系统调用实现输出功能。同时,给出了Makefile配置,说明了如何编译和链接汇编源代码。

299

被折叠的 条评论
为什么被折叠?



