of course you are right. but maybe you are missing the point why the
original author (m2) wrote it exactly as it is: to save precious 2 bytes in
the boot sector code

Tom



am 6. Dezember 2009 um 00:32 schrieben Sie:

> Hi,

> the LBA detection of the FAT12/FAT16 boot sectors (both for the FreeDOS
> and "OEM" kernels) could misdetect that a BIOS does support LBA if it
> doesn't really. This is the used code (after calling Int13.41 for the boot
> unit):

>> shr cx, 1
>> ; CX must have 1 bit set
>> sbb bx, 0aa55h - 1
>> ; tests for carry (from shr) too!
>> jne read_normal_BIOS

> This test succeeds if (cx&1) && (bx==AA55h) as intended but also succeeds
> if (!(cx&1)) && (bx==AA54h). This is a highly unlikely case but  
> nonetheless an error which should be corrected. Example:

>> sub bx, 0AA55h
>> jne read_normal_BIOS
>> shr cx, 1
>> jnc read_normal_BIOS

> Note that the code after this expects bx to be zero, so sub must be used
> here instead of cmp. I exchanged the order of the test for cx bit 0 (disk
> access support) and the correct signature in bx since it's easier to  
> understand the code this way. (It would work the other way around as well.)

> Regards,
> Christian



------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Freedos-kernel mailing list
Freedos-kernel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to