Linux0.11 系统启动时所调用的BIOS中断

1 显示字符串

Line:72: int 0x13

mov dx,#0x0000 ! drive 0, head 0

mov cx,#0x0002 ! sector 2, track 0

mov bx,#0x0200 ! address = 512, in INITSEG(0x90000)

mov ax,#0x0200+SETUPLEN !service 2, number of sectors(SETUPLEN=4)

int 0x13 ! read it

对于int 0x13, 注意,intel CPU是 little endian的。

ah: 功能号 0x02–读磁盘数据到内存

al: 需要读出的扇区的数量

ch: 磁道(柱面)号的低8位

cl: 开始扇区(0-5bit),磁道号的高两位(6-7bit)

dh: 磁头号, dl: 驱动器号(if it’s hard-disk, set the 7th bit)

es:bx: 目的地址。

在第59行,已经将es设为了0x9000

57:

go: mov ax,cs ! currently, the cs is 0x9000, INITSEG

mov ds,ax ! set the stack bottom

mov es,ax ! For Line 72, interrupt

***********************************************

***********************************************

Line 85: int 0x13 ! To get the disk drive parameters,

specifically number of sectors/track

Line 83:

mov dl, #0x00

mov ax,#0x0800 ! ah=8 is get drive parameters

int 0x13

mov ch,#0x00

seg cs

mov sectors, cx

mov ax, #INITSET

mov es, ax

ah=8,功能号–读取磁盘参数

bl=0, 驱动器号(如果时硬盘,则要置位7为1)

返回:

ax=0, bl=驱动器类型

ch=最大磁道号的低8位, cl=每磁道最大扇区数(0-5bit),最大磁道号高2位(6-7bit)

dh=最大磁头数, dl=驱动器数量

es:di, 软驱磁盘参数表。 因此有最后一句 mov es, ax恢复堆栈栈低

***********************************************

***********************************************

Line 96,102: int 0x10读取光标位置,显示字符串

Line 94:

mov ah,#0x03 !read cursor position

xor bh,bh !page number to read

int 0x10 ! The return value: ch:start line to scan, cl:end line to scan,

! dh:line number, dl: column number

mov cx,#24 !The length of string

mov bx,#0x0007 !page 0,attribute 7(normal)

mov bp,#msg1 !es:bp point to the string to be displayed

mov ax,#0x1301 !write string, move cursor

int 0x10 !Turn the cursor point to be the tail of the string.

第一次int 0x10注释的很详细了,

第二次int 0x10中,

ah=0x13, 功能号,显示字符串

al,光标放置方式及规定属性 0x01–光标停在字符串结尾处

es:bp 字符串的起始位置

cx, 字符串的字符数

bh, 显示页面号 bl, 字符属性

dh: dl, 行号:列号

***********************************************

***********************************************

可以提高你的水平。(戏从对手来。

Linux0.11 系统启动时所调用的BIOS中断

相关文章:

你感兴趣的文章:

标签云: