For Programmers: Free Programming Magazines  


Home > Archive > A86 Assembler > May 2004 > how to get some values for LBA <-> CHS conversion?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to get some values for LBA <-> CHS conversion?
lallous

2004-05-26, 3:31 pm

Hello

I am trying to apply this formula (found @
http://encyclopedia.thefreedictiona...HS%20conversion):

[quote]
>From CHS to LBA

The equation to convert from CHS to LBA follows:


LBA = ( ( CYL * HPC + HEAD ) * SPT ) + SECT - 1

Where:

LBA: linear base address of the block
CYL: value of the cylinder CHS coordinate
HPC: number of heads per cylinder for the disk
HEAD: value of the head CHS coordinate
SPT: number of sectors per track for the disk
SECT: value of the sector CHS coordinate
[/quote]

I have read the partition table and got these values: CYL, HEAD, SECT; how
can I get the other missing variables (SPT & HPC) ?

--
Elias


Bill Marcum

2004-05-31, 3:30 pm

["Followup-To:" header set to comp.lang.asm.x86.]
On Wed, 26 May 2004 17:59:27 +0000 (UTC), lallous
<lallous@lgwm.org> wrote:
> Hello
>
> I am trying to apply this formula (found @
> http://encyclopedia.thefreedictiona...HS%20conversion):
>
> [quote]
> The equation to convert from CHS to LBA follows:
>
>
> LBA = ( ( CYL * HPC + HEAD ) * SPT ) + SECT - 1
>
> Where:
>
> LBA: linear base address of the block
> CYL: value of the cylinder CHS coordinate
> HPC: number of heads per cylinder for the disk
> HEAD: value of the head CHS coordinate
> SPT: number of sectors per track for the disk
> SECT: value of the sector CHS coordinate
> [/quote]
>
> I have read the partition table and got these values: CYL, HEAD, SECT; how
> can I get the other missing variables (SPT & HPC) ?
>

There's a BIOS call to get them, or you can just assume the standard
fictitious values of 16 heads and 63 sectors, unless you are actually
using an ancient MFM or RLL drive. On modern drives, the actual
physical location of a sector on the disk is known only to the drive's
circuitry.


--
Somewhere, just out of sight, the unicorns are gathering.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com