nasm的helloworld
开始学习Nasm的东西,先来一个最简单的有输出的程序
1 org 0x0100
2 jmp start
3 msg db 'hello,world',13,10,'$'
4 start:
5 mov dx,msg
6 mov ah,09h
7 int 21h
8 ret
这个程序可以在Windows下编译运行,需要编译成.com 文件才能运行。
编译选项nasmw.exe hello.asm -o hello.com,然后直接运行hello.com就可以了。
需要注意的地方,这里调用了windows DOS下才有的 int 21h,所以在unix下是不能运行的。