我正在使用Bochs 2.4.5编写引导扇区代码。我使用INT 13H从软盘中读取扇区。但是我发现,如果要读取的扇区数>72,则INT13会失败。返回码为AH = 1。以下是代码,这里是INT13。返回码为AH = 1。
为什么INT 13H不能读取超过72个扇区?
为什么INT 13H不能读取超过72个扇区?
xorb %ah, %ah
xorb %dl, %dl
int $0x13 # reset the floppy
movw $0x8000, %ax
movw %ax,%es
movw $0, %bx # ES:BX is the buffer
movb $0x02, %ah
movb $73, %al # how many sectors to read. 72 is ok, but >=73 is wrong.
movb $0, %ch
movb $1, %cl
movb $0, %dh
movb $0, %dl
int $0x13
感谢任何帮助。
更新
按照Matthew Slattery的指示,我找到了相应的代码。我在这里列出来,为像我一样困惑的其他人提供帮助。完整的代码可以在这里找到。
7220 if ((drive > 1) || (head > 1) || (sector == 0) ||
7221 (num_sectors == 0) || (num_sectors > 72)) {
7222 BX_INFO("int13_diskette: read/write/verify: parameter out of range\n");
7223 SET_AH(1);
7224 set_diskette_ret_status(1);
7225 SET_AL(0); // no sectors read
7226 SET_CF(); // error occurred
7227 return;
7228 }
bios/rombios.c
的第7211行(截至Bochs v2.4.5),实际上是int13_diskette_function()
内相关case
语句的开头 - 参数验证(包括范围检查)是其中的第一个if (...)
,位于7220-7221行。 - Matthew Slattery