发信人: sle()
整理人: (2000-04-08 08:35:19), 站内信件
|
(原创段峥)
预备知识
注意,以下的block概念即原先的逻辑扇区号
disk_addr_pkt struc
packet_size db 16 ;size of packet in bytes
reserved db 0 ;reserved, must be 0
block_count dw ? ;number of blocks to transfer
buffer_addr dd ? ;address of transfer buffer
block_num dq ? ;starting absolute block number
disk_addr_pkt ends
第一个参数是保留为将来调整使用的,它包含了地址包的大小(以字节计数,包 括自身)
在这个版本中它必须被设置为16,否则将返回AH=01H(BAD COMMAND)
block_count的含义是:
作为输入时是将被传送的块的数量,
作为输出时是实际传送的块的数量
buffer_addr是个32位的地址,指向传输数据的缓冲区地址。
block_num是块的标号,不管分区位置,第一个块的标号为0,就是主
引导记录的块号
1;扩展读取
AH = 42H
DL = Drive number
DS:SI = Disk address packet
返回值:
CF = 0
AH = 0
CF = 1
AH = error code(参见原中断13 status值)
此功能用于从磁盘上读取扇区到内存中,如果出错,在结构
Disk address packet中的block_count域将置为出错前读取到
的数目
2;扩展存写
AH = 43H
AL
第0位 = 0 校验关闭(不校验)
= 1 校验打开(校验)
第1-7位保留,设定为0
DL = Drive number
DS:SI = Disk address packet
返回值:
同上
备注:
如果写校验不支持,BIOS将拒绝请求并返回AH=01H(BAD COMMAND)
另外功能号48H可以检测是否支持写校验。
3、获得磁盘参数表
AH = 48H
DL = Drive number
DS:SI = address of result buffer
返回值:
CF = 0
AH = 0
DS:SI = result buffer,各项结构定义如下
info_size dw 26 ;此结构大小
flags dw ? ;此信息标记,说明如下
cylinders dd ? ;不用说明了吧
heads dd ?
sec_per_track dd ?
sectors dq ?
sector_size dw ?
CF = 1
AH = error code
说明:
此功能用于获得磁盘的有关物理参数
结构说明:
info_size 包括其自身的整个结构大小,调用此功能前必须由调用者
填写,标明传入的缓冲区大小,并在返回时由INT13填写,指明返回
信息块大小
flags 标明一些特殊信息,0-6位已定义,其余设为保留必须为0。
各位说明如下:
Bit 0 has the following meaning:
0 = DMA boundary errors may occur
1 = DMA boundary errors will be handled transparently
If this bit set, it indicates that the ROM BIOS will handle DMA
boundary error conditions automatically, and DMA boundary errors
(error code 09h) will never be returned to the caller.
Bit 1 has the following meaning:
0 = Cylinder/head/sector-per-track info not supplied
1 = Cylinder/head/sector-per-track info valid
Bit 1 will be clear for block devices for which traditional geometry
descriptions are inappropriate.
Bit 2 has the following meaning:
0 = Drive is not removable
1 = Drive is removable
Bit 3 has the following meaning:
0 = Drive does not support write with verify
1 = Drive supports write with verify
Bit 3 indicates whether the Write with Verify (4301h)
is supported on this drive.
Bit 4 has the following meaning:
0 = Drive does not have change line support
1 = Drive has change line support
Bit 4 must be set for removable drives accessed
via drive numbers 80h and above, as well as appropriate
drives numbered 0-7Fh.
Bit 5 has the following meaning:
0 = Drive is not lockable
1 = Drive is lockable
Bit 5 must be set for removable drives accessed via
drive numbers 80h and above, as well as appropriate
drives numbered 0-7Fh.
Bit 6 has the following meaning:
0 = CHS values are for the media that is currently
in the drive (removable media only); values
must be returned for the media if the media is
in the drive.
1 = CHS values are maximum supported by the drive
(when there is no media in the drive)
-- sigh,,曾经有一盆清蒸的甲鱼摆在我的面前,可是我却没有珍惜,
等到它被人瓜分的时候才追悔莫及,人世间最痛苦的事莫过于此。
如果上天能够给我一个再来一次的机会,我会对它说:“我吃你”
如果要给这份遗憾加上一个期限,我愿是---一分钟。
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 210.72.235.145]
|
|