继续上1P,我们现在要开始读取光驱里面的内容了。以前我描述过BIOS显示服务和磁盘服务(这里),但是我只将了CHS读软盘,没有涉及到硬盘和光驱。由于硬盘和光驱的构造与软盘截然不同,使用读软盘的手段是行不通的,为此,BIOS给我们提供了扩展13h中断。
Continue to the next part, we are going to read the content in the cdrom. I described the bios display service and disk service in previous posts (Here, in Chinese), but I only introduced the way to read floppy through CHS method, but not harddisk and cdrom. Because the hardware construction of these devices are totally different, we cannot apply the floppy-way to harddisk(ATA) and cdrom(ATAPI) devices. In order to solve the problem, BIOS provides us extended int 13h.
| Register | Value | Description |
| AH | Function(0x42) | Extended Read from ATA/ATAPI Device |
| DL | Drive Number | |
| DS:SI | Address of Disk Address Packet | |
参数和读软盘不一样了。我们使用Disk Address Packet(DAP, 磁盘地址包)来间接传递参数,而不是传CHS信息。DAP的构造如下表:
The argument is different from the normal read function. We no longer pass the CHS arguments to the BIOS, but a Disk Address Packet(DAP) instead. The format of DAP is described by the following table:
| Offset | Size | Name | Description |
| 0 | 1 | Packet Size | Always 16 (At least now) |
| 1 | 1 | Reserved | Should be zero |
| 2 | 2 | Sector Count | Number of sectors to read |
| 4 | 4 |

本文介绍了如何通过BIOS扩展13h中断读取光驱内容,重点讲解了Disk Address Packet(DAP)的构造和使用。在解析光盘文件系统ISO 9660时,讨论了主卷描述符和目录项,阐述了通过路径表或层级查找文件的方法,并展示了如何逐级找寻并加载文件。
最低0.47元/天 解锁文章
1600





