confusion in converting LBA to CHS
Posted: Tue May 11, 2010 8:04 am
I am reading the tutorial 6 bootloader 4 chapter
As written here :
absolute sector = (logical sector / sectors per track) + 1
and the code written after this:
Then the formula for calculating sector should have been :
absolute sector = (logical sector MOD sectors per track) + 1
correct me if I am wrong.
As written here :
absolute sector = (logical sector / sectors per track) + 1
and the code written after this:
But in 16 bit division , where AX stores the quotient and DX stores the remainder. Hence a remainder is being stored in dl and that is next stored in the variable absoluteSector.xor dx, dx ; prepare dx:ax for operation
div WORD [bpbSectorsPerTrack] ; divide by sectors per track
inc dl ; add 1 (obsolute sector formula)
mov BYTE [absoluteSector], dl
Then the formula for calculating sector should have been :
absolute sector = (logical sector MOD sectors per track) + 1
correct me if I am wrong.