汇编的书写顺序问题
代码如下,最简单的Hello worldsection .text ;section declaration
global _start
_start:
mov edx,len ;third argument: message length
mov ecx,msg ;second argument: pointer to message to write
mov ebx,1 ;first argument: file handle
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov ebx,0 ;first syscall argument: exit code
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data ;section declaration
msg db "Hello, World!",0xa ;our dear string
len equ $ - msg ;length of our dear string
汇编执行都没问题,但是这样写
section .text ;section declaration
global _start
section .data ;section declaration
msg db "Hello, World!",0xa ;our dear string
len equ $ - msg ;length of our dear string
_start:
mov edx,len ;third argument: message length
mov ecx,msg ;second argument: pointer to message to write
mov ebx,1 ;first argument: file handle
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov ebx,0 ;first syscall argument: exit code
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
把data section写到start前面为啥就汇编错误呢? 汇编代码中,_start入口符号所在的段必须卸载最后面吗?还是说这就是Intel语法?书写顺序上有啥讲究吗?谢谢。
页:
[1]