<自己动手写操作系统>2011032901

【分析】

部分代码:
;=====================================================================================

    jmp short LABEL_START        ; Start to boot.

    nop                          ; 这个 nop不可少

    ; 下面是 FAT12 磁盘的头

    BS_OEMName    DB 'ForrestY'    ; OEM String, 必须 8 个字节

    BPB_BytsPerSec    DW 512        ; 每扇区字节数

    BPB_SecPerClus    DB 1        ; 每簇多少扇区

    BPB_RsvdSecCnt    DW 1        ; Boot 记录占用多少扇区

    BPB_NumFATs    DB 2        ; 共有多少 FAT 表

    BPB_RootEntCnt    DW 224        ; 根目录文件数最大值

    BPB_TotSec16    DW 2880        ; 逻辑扇区总数

    BPB_Media    DB 0xF0        ; 媒体描述符

    BPB_FATSz16    DW 9        ; 每FAT扇区数

    BPB_SecPerTrk    DW 18        ; 每磁道扇区数

    BPB_NumHeads    DW 2        ; 磁头数(面数)

    BPB_HiddSec    DD 0        ; 隐藏扇区数

    BPB_TotSec32    DD 0        ; 如果 wTotalSectorCount 是 0 由这个值记录扇区数

    BS_DrvNum    DB 0        ; 中断 13 的驱动器号

    BS_Reserved1    DB 0        ; 未使用

    BS_BootSig    DB 29h        ; 扩展引导标记 (29h)

    BS_VolID    DD 0        ; 卷序列号

    BS_VolLab    DB 'Tinix0.01  '; 卷标, 必须 11 个字节

    BS_FileSysType    DB 'FAT12   '    ; 文件系统类型, 必须 8个字节
;上面的代码在http://www.cnblogs.com/GoGoagg/archive/2011/03/18/1988036.html文章中有描述了


LABEL_START:  

    mov    ax, cs

    mov    ds, ax

    mov    es, ax

    mov    ss, ax

    mov    sp, BaseOfStack



    ; 清屏

    mov    ax, 0600h        ; AH = 6,  AL = 0h

    mov    bx, 0700h        ; 黑底白字(BL = 07h)

    mov    cx, 0                ; 左上角: (0, 0)

    mov    dx, 0184fh        ; 右下角: (80, 50)

    int    10h
   
;着重看下清屏代码   
在网络找到这么一个说明:
  Interrupt:       10h           Functions:     06h   and   07h

Initializes   a   specified   window   of   the   display   to   ASCII   blank
characters   with   a   given   attribute,   or   scrolls   the   contents   of
a   window   by   a   specified   number   of   lines.

Input
AH   =   06h   to   scroll   up
     =   07h   to   scroll   down
AL   =   Number   of   lines   to   scroll   (if   zero,   entire   window   is   blanked)
BH   =   Attribute   to   be   used   for   blanked   area
CH   =   y   coordinate,   upper   left   corner   of   window
CL   =   x   coordinate,   upper   left   corner   of   window
DH   =   y   coordinate,   lower   right   corner   of   window
DL   =   x   coordinate,   lower   right   corner   of   window
本地测试此int 10h,有效果~暂时学习到这里,具体参数的变化后续参阅相关资料
原文地址:https://www.cnblogs.com/GoGoagg/p/1999165.html