赞
踩
;NASM 汇编
;nasm this.asm -o hello_os
org 07c00h
mov ax, cs
mov ds, ax
call welcome_words
call load_os
jmp os
welcome_words:
mov ax,boot_message
mov bp,ax ;bp存储需要显示的字符串的起始地址
mov cx,boot_message_length ;cx存储要显示的字符串的长度
mov ax,01301h ;ah=13h,是int 10h中断的参数之一,al=01h,标识输出方式
mov bx,000ah ;bh为页码,bl为颜色
mov dx,0d00h ;dx为显示位置坐标,0d行,0列
int 10h
ret
load_os:
mov ah,02h ;读磁盘扇区
mov al,01h ;读取1个扇区
mov ch,00h ;起始磁道
mov cl,02h ;起始扇区
mov dh,00h ;磁头号
mov dl,00h ;驱动器号
mov bx,os ;存储缓冲区
int 13h
ret
boot_message:
db "[Boot]modu os"
db 0dh,0ah ;换行
db "[Boot]loading..."
boot_message_length equ $-boot_messa
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。