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, 行號:列號
***********************************************
***********************************************