Member Avatar for zbits

How do you apply the correct math formula from wikipedia?

Wikipedia's math formula:

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

LBA to CHS code from brokenthorn:

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

Why do you want to convert LBA to CHS? If you are thinking about the int 13h functions 2 and 3, try using their LBA equivalents, 42h and 43h instead.

Most hard disks nowadays are programmed at the hardware level using LBA, and the conversion to CHS is done by the disk's internal firmware.

Member Avatar for zbits

The code came from brokenthorn's site. It's int 13h and I didn't know what I was into.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.