汇编写hello world

testone.s

output:
        .ascii "hello world!\n"

.globl main
main:
        movl $4, %eax
        movl $1, %ebx
        movl $output,%ecx
        movl $13,%edx
        int  $0x80
        movl $1, %eax
        movl $0, %ebx
        int  $0x80

EAX包括系统调用值,write是4

EBX包括要写入的文件描述符,0表示标准输入。1表示标准输出。2表示错误输出

ECX包括字符串的开头

EDX包括字符串的长度

movl $1, %eax          //1表示退出函数
movl $0, %ebx          //返回值为0

猜你喜欢

转载自blog.csdn.net/woailp___2005/article/details/113584428