最近再看《Orange‘s一個操作系統的實現》,裡面用的是intel的匯編語法,自己比較習慣AT&T的語法了,自己研究了好長時間才將代碼修改成功。
.code16指示as生成16位的代碼。While `as' normally writes only "pure" 32-bit i386 code or 64-bit x86-64 code depending on the default configuration, it also supports writing code to run in real mode or in 16-bit protected mode code segment.
編譯的話 as -o boot.o boot.s ;
ld -Ttext=0x7c00 --oformat binary -o boot.bin boot.o;
這樣就ok了~~