自分でオペレーティングシステムのノートを書く


まず準備をする
nasm(コンパイルアセンブリ)、bochs(小型仮想マシン)をダウンロードします.
bochsのインストール
tar vxzf bochs-x.x.x.tar.gz
cd bochs-x.x.x
./configure --enable-debugger --enable-disasm
make
sudo make install
boot.asmの作成は以下の通りです.
	org	07c00h			;  7c00 
	mov	ax, cs
	mov	ds, ax
	mov	es, ax
	call	DispStr			;  
	jmp	$			;  
DispStr:
	mov	ax, BootMessage
	mov	bp, ax			; ES:BP =  
	mov	cx, 16			; CX =  
	mov	ax, 01301h		; AH = 13,  AL = 01h
	mov	bx, 000ch		;  0(BH = 0)  (BL = 0Ch, )
	mov	dl, 0
	int	10h			; 10h  
	ret
BootMessage:		db	"Hello, OS world!"
times 	510-($-$)	db	0	;  , 512 
dw 	0xaa55				;  

nasmでnasm bootをコンパイルする.asm -o boot.bin
bochsでFDミラーbximage選択fdを作成する
FD dd if=bootにブートを書き込む.bin of=a.img bs=512 count=1 conv=notrunc
bochsプロファイルbochsrcの作成
###############################################################
# Configuration file for Bochs
###############################################################

# how much memory the emulated machine will have
megs: 32

# filename of ROM images
romimage: file=/usr/local/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/local/share/bochs/VGABIOS-elpin-2.40

# what disk images will be used 
floppya: 1_44=a.img, status=inserted

# choose the boot disk.
boot: floppy

# where do we send log messages?
log: bochsout.txt

# disable the mouse
mouse: enabled=0

# enable key mapping, using US layout as default.
keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/x11-pc-us.map

bochs-f bochsrcを実行できます