SECTION .DATA
hello: db 'Hello world!',10 ; 定义一个字符串
helloLen: equ $-hello; 计算字符串长度,$意思是取当前地址,- 相当于前面已经定义的字符串的长度,如果在中间再增加一个变量,那就是增加后的偏移
; Code goes in the text section
SECTION .TEXT
GLOBAL _start
_start:
mov eax,4 ; 'write' system call = 4
mov ebx,1 ; file descriptor 1 = STDOUT
mov ecx,hello ; string to write
mov edx,helloLen ; length of string to write
int 80h ; call the kernel 系统调用中断
; Terminate program
mov eax,1 ; 'exit' system call
mov ebx,0 ; exit with error code 0
int 80h ;