as编写hello,world
来源:互联网 发布:mac os系统dmg镜像 编辑:程序博客网 时间:2024/05/16 15:14
.text.global _start_start: movl $len,%edx movl $msg,%ecx movl $1,%ebx movl $4,%eax int $0x80 movl $0,%ebx movl $1,%eax int $0x80.datamsg: .ascii "hello,world\n" len=.-msg .ascii "after hello\n" len2=.-msg
我们来看代码段部分,.data表示一个代码段的开始,msg:标号仅仅给编译器看的,它只代表当前地址。len=.-msg得到数据段第一个字符串长度,同理len2是第一个字符串和第二个字符串长度之和。_start代表as汇编程序的默认入口。movl $msg,%ecx,将标号代表的地址放到ecx中。上述程序输出:hello,world。如果把代码段movl $len,%edx改成 movl $len2,$edx,输出如下:
hello,world
after,hello
注意:as86汇编语言中,标号的意思是一个偏移值,而不是地址。
参考文章:
http://www.cnblogs.com/justinzhang/archive/2012/02/20/2360513.html
0 0
- as编写hello,world
- spring编写hello world
- hello world编写
- c编写hello world
- 使用 MXML 编写 Hello World
- 编写 Hello world 模块驱动
- 编写 Hello world 模块驱动
- COBOL语言编写<hello world>
- 编写linux驱动--Hello World
- 汇编语言编写的Hello World
- Dropwizard 编写Hello world应用
- AS下利用NDK输出Hello World!
- 不使用main编写的“Hello,World”
- 用Python编写运行Hello World程序
- 达芬奇平台编写hello world程序
- 用Microwindows(Nano-X)编写“hello world”
- 用Eclipse编写Hello World程序
- 关于android hello world程序的编写
- equals和 hashcode的区别
- RUP
- 关于strtok函数【转】
- 迭代器模式
- 函数指针例子
- as编写hello,world
- Linux shell脚本(2)
- HDOJ 2089 不要62
- leetcode第一刷_Sum Root to Leaf Numbers
- Java编程思想摘录--第1章 对象入门
- 泡过的茶叶有何用途
- uva673
- NYOJ58-最少步数
- Boa的移植过程