|
|
很简单的hello world,使用BIOS中断,用AT&T格式写的
es:bp=字符串地址
al=写方式
cx=字符串长度
dh/dl=起始行/列
bh/bl=页号/属性
编译通过,连接出错:
hello.o(.text+0xa): In function `_start':
: relocation truncated to fit: R_386_16 .data
hello.o(.text+0xe): In function `_start':
: relocation truncated to fit: R_386_16 .data
make: *** [all] Error 1
代码如下
.data
msg: .string "Hello World\n"
len: .int 12
.text
.global _start
_start:
movw $0x1301, %ax
movw $0x0007, %bx
movw $len, %cx
movw $msg,%bp
int $0x13
movl $0,%ebx #退出
movl $1,%eax
int $0x80 |
|