linux簡單之美(三)
在linux簡單之美(二)中我們嚐試使用了C庫的函數完成功能,那麼能不能用syscall方式
來搞呢?顯然可以!
section .data ft db "now is X",10 section .text global _start _start: mov edi,10 again: dec edi mov eax,edi add eax,0x30 mov byte [ft+7],al mov eax,4 mov ebx,1 mov ecx,ft mov edx,9 int 0x80 mov eax,162 push 0 push 1 mov ebx,esp mov ecx,0 int 0x80 cmp edi,0 jnz again mov eax,4 mov ebx,1 mov ecx,msg mov edx,15 int 0x80 mov eax,1 mov ebx,0 int 0x80 msg: db "happy xxx day!",10
nasm -f elf main.asm
ld -m elf_i386 -o main main.o
在代碼中延時使用的是nanosleep,其他和第一篇一致,隻不過做了一個bin->ascii的小轉換.
最後更新:2017-04-04 07:03:18
上一篇:
淺析微軟Win 8係統激活的各種問題
下一篇:
最炫民族風!體驗國人新寵Linux Deepin
雲服務器 ECS 建站教程:Drupal建站教程(CentOS7)
輕鬆搭建Windows8雲平台開發環境
MVC架構探究及其源碼實現(1)-理論基礎
ubuntu 12.04 install java
《Linux From Scratch》第二部分:準備構建 第五章:構建臨時文件係統- 5.33. Util-linux-2.26
全球經濟依賴的微芯片:製造商隻剩下4家了
《配置管理最佳實踐》——2.5 構建工具評估和選擇
Android創建和刪除桌麵快捷方式
Writing your first Django app, part 1
DT科技評論第35期:可以解鎖任何手機的萬能指紋