汇编学习之nasm编译器下载使用
生活随笔
收集整理的這篇文章主要介紹了
汇编学习之nasm编译器下载使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我是在centos7虛擬機上面進行試驗學習,所以對應的結果和輸入都是命令行的輸入輸出。
使用wegt命令下載壓縮包,解壓
tar -xvzf nasm-2.14.tar.gz切換到對應目錄并編譯安裝
cd nasm-2.14 ./configure make 編譯 make install 安裝編譯安裝過程中會出現很多warning,一開始也是很緊張,不過暫時還沒發現有什么不好的現象,主要是說c99不支持之類的警告信息
2. 測試nasm編譯器
直接就當前目錄進行編程
直接照抄網上大神的一篇hello,world的匯編測試代碼
section .data ;section declaration msg db "Hello, world!",0xA ;our dear string len equ $ - msg ;length of our dear string section .text ;section declaration;we must export the entry point to the ELF linker orglobal _start ;loader. They conventionally recognize _start as their;entry point. Use ld -e foo to override the default. _start: ;write our string to stdoutmov eax,4 ;system call number (sys_write)mov ebx,1 ;first argument: file handle (stdout)mov ecx,msg ;second argument: pointer to message to writemov edx,len ;third argument: message lengthint 0x80 ;call kernel ;and exitmov eax,1 ;system call number (sys_exit)xor ebx,ebx ;first syscall argument: exit codeint 0x80 ;call kernel編譯
nasm -f elf64 hello.s -o hello.o鏈接
ld -s hello.o -o hello.out最后運行hello.out就行,輸出結果如下:
[root@jack nasm-2.14]# ./hello.out Hello, world!至此nasm編譯器的學習和使用算是拉開了序幕。
補:win10下64位系統官網下載
這個直接點進去下載就可以了,下載后的使用也是黑窗口的樣式的。
總結
以上是生活随笔為你收集整理的汇编学习之nasm编译器下载使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《断弦》感想
- 下一篇: 网上书店订单流程c语言源代码,网上书店的