I really found the problem! Thanks, wengier, for the detailed description of this BUG! Without your description, it would have been very hard to find where the problem was. GRUB for DOS cannot do without you, brother wengier.
In grldrstart.S, there is the following piece of code:
movb %al, %cl
xorb %ch, %ch /* CX = number of sectors read */
shlw $9, %cx /* CX = number of bytes read */
addw %cx, %bx /* ES:BX points to new location */
jnc 2f
movw %es, %ax /* BX=0, exceeds 64K boundary, adjust ES */
addw $0x1000, %ax
movw %ax, %es
movb $0x80, %ah /* adjust max number of sectors to read */
2:
If changed as follows, it should be OK:
movb %al, %cl
/* xorb %ch, %ch */ /* CX = number of sectors read */
Comment out this statement because it is redundant. Keeping it is not exactly wrong either. Note that below there is a shlw statement that shifts left by 9 bits.
shlw $9, %cx /* CX = number of bytes read */
This statement is the key. If the sector count CX= 0x80, then after shifting left by 9 bits, CX becomes 0!!!!
jz 3f
When CX=0, jump to label 3: to execute the statements that adjust ES.
addw %cx, %bx /* ES:BX points to new location */
If CX is 0, adding it to BX cannot possibly produce a carry. Executing the JNC below will jump directly to label 2:.
jnc 2f
3:
movw %es, %ax /* BX=0, exceeds 64K boundary, adjust ES */
addw $0x1000, %ax
movw %ax, %es
movb $0x80, %ah /* adjust max number of sectors to read */
2:
Under ftp://ftp.cosoft.org.cn/incoming/ there are already too many GRUB files, it feels a bit like garbage. So I'm a little afraid to upload there. Can anyone provide another upload space, temporary? Because there have been a lot of changes recently, I don't want to upload to cosoft's valuable space for every tiny little change.
If there is no other upload space, then either wait and update everything together next time, or trouble you two brothers to compile the update yourselves.
因为我们亲手创建,这个世界更加美丽。