废话不多说,直接上boot.asm文件代码
org 0x7c00 ;设定引导起始地址
BaseOfStack equ 0x7c00 ;设定常量BaseOfstack为0x7c00
Label_Start:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, BaseOfStack ;栈顶设置为0x7c00
;======= clear screen
mov ax, 0600h ;ah=06h时,int 10h中断设置滚动窗口的功能, al=0则实现清屏
mov bx, 0700h
mov cx, 0
mov dx, 0184fh
int 10h
;======= set focus
mov ax, 0200h ;ah=02h时,int 10h中断为设置光标
mov bx, 0000h
mov dx, 0000h
int 10h
;======= display on screen : Start Booting......
mov ax, 1301h ;ah=13h时,int 10h中断为显示一行字符串
mov bx, 000fh
mov dx, 0000h
mov cx, 10
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"
;======= fill zero