参考书:一个64位操作系统的设计与实现
第一个boot程序代码如下,基本上没有不理解的地方
org 0x7c00 ;必须指定位置,不然编译器会将其放到位置0
BaseOfStack equ 0x7c00
Label_Start:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, BaseOfStack
;======= clear screen
mov ax, 0600h ;中断10h,ax不同的值有不同功能
mov bx, 0700h
mov cx, 0
mov dx, 0184fh
int 10h
;======= set focus
mov ax, 0200h
mov bx, 0000h
mov dx, 0000h
int 10h
;======= display on screen : Start Booting......
mov ax, 1301h
mov bx, 000fh
mov dx, 0000h
mov cx, StartBootMessagend-StartBootMessage
push ax
mov ax, ds
mov es, ax
pop ax
mov bp, StartBootMessage
int 10h
;======= reset floppy
xor ah, ah
xor dl, dl
int 13h
jmp $
StartBootMessage: db "Start Boot..."
StartBootMessagend:
;======= fill zero until