您是否嘗試過這個文檔,標題爲 「Linux的大會教程」
http://docs.cs.up.ac.za/programming/asm/derick_tut/
它,例如,一個 「Hello World」 曰(逐字複製):
section .data
hello: db 'Hello world!',10 ; 'Hello world!' plus a linefeed character
helloLen: equ $-hello ; Length of the 'Hello world!' string
; (I'll explain soon)
section .text
global _start
_start:
mov eax,4 ; The system call for write (sys_write)
mov ebx,1 ; File descriptor 1 - standard output
mov ecx,hello ; Put the offset of hello in ecx
mov edx,helloLen ; helloLen is a constant, so we don't need to say
; mov edx,[helloLen] to get it's actual value
int 80h ; Call the kernel
mov eax,1 ; The system call for exit (sys_exit)
mov ebx,0 ; Exit with return code of 0 (no error)
int 80h
(谷歌查詢我得到這個從:https://www.google.co.uk/search?q=how+to+write+drivers&oq=how+to+write+drivers)
有一個原因,你不寫機器代碼 - 它是非常具體的個別處理器。快速谷歌出現:http://www.programmersheaven.com/mb/pharabee/344751/344751/how-to-write-a-assembler/ – 2013-02-08 23:50:07
根據你想要去的方向,我建議或者osdev wiki或Linux內核模塊接口教程。 – Dougvj 2013-02-09 00:13:26