hello world 的学习
SECTION .data
msg db 'Hello World!', 0Ah
SECTION .text
global _start
_start:
mov edx,13
// 要写的字节数,每个字母加换行字符
// 要写的字节数
mov ecx,msg
//把信息字符的内存地址移到ecx中
mov ebx,1
// 写入标准输出文件
mov eax,4
// 调用 SYS_WRITE(kernel opcode 4)
int 80h
mov ebx, 0
//在退出时的状态 “没有错误”
mov eax, 1
//调用退出SYS_EXIT(kernel opcode 1)
int 80h
SECTION .data
msg db 'hello, brave new world!', 0Ah
;calculate string length
SECTION .text
global _start
_start:
mov ebx,msg
mov eax,ebx
nextchar:
cmp byte[eax],0
jz finished
inc eax
jmp nextchar
finished:
sub eax, ebx
mov edx, eax
mov ecx, msg
mov ebx, 1
mov eax, 4
int 80h
mov ebx, 0
mov eax,1
int 80h