Page 1 of 1 [ 3 posts ] 

kmalloc
Hummingbird
Hummingbird

User avatar

Joined: 10 Dec 2013
Age: 30
Gender: Male
Posts: 21

03 Feb 2014, 2:28 am

I'm trying to make a boot sector and how do you apply the correct math that's from wikipedia?

wikipedia's math formula

Quote:
lba = ((c * hpc)+h) * spt +s -1


lba to chs from brokenthorn
Quote:
xor dx, dx
div word[bpbSectorsPerTrack]
inc dl
mov byte[absoluteSector],dl
xor dx, dx
div word[bpbHeadsPerCylinder]
mov byte[absoluteHead], dl
mov byte[absoluteTrack], al
ret



ruveyn
Veteran
Veteran

User avatar

Joined: 21 Sep 2008
Age: 84
Gender: Male
Posts: 31,502
Location: New Jersey

03 Feb 2014, 2:53 pm

What do the symbols mean?



kmalloc
Hummingbird
Hummingbird

User avatar

Joined: 10 Dec 2013
Age: 30
Gender: Male
Posts: 21

03 Feb 2014, 6:04 pm

What I'm trying to do is use the correct LBA to CHS math formula in assembly language.

C, H, and S are the cylinder numbers, the head numbers, and the sector numbers.
LBA is the logical block address.
HPC is the maximum number of heads per cylinders (reported by disk drive, typically 16 for 28-bit LBA)
SPT is the maximum number of sectors per track (reported by disk drive, typically 63 for 28-bit LBA)