CHS (Cylinder-Head-Sector) Address
CHS addressing is an early method for giving addresses to each physical block of data on a hard disk drive, identifying individual sectors on a disk by their position in a track, where the track is determined by the head and cylinder numbers.
npm
Install via$ npm install --save chs
Usage
// Load modulevar CHS =
// Create a CHS addressvar addr = 5 20 8
// Properties:var c = addrcylindervar h = addrheadvar s = addrsector
// Convert to an LBA (Logical Block Address)var lba = addrvar lba = addr
// Set it to an LBAaddraddr
// Get it as a buffervar buf = addrbuffervar buf = addr
// Set from bufferaddrbuffer = 0xFE 0xFF 0xFF addr
API Reference
CHS
Kind: global class
- CHS
- new CHS([cylinder], [head], [sector])
- instance
- .cylinder :
Number
- .head :
Number
- .sector :
Number
- .buffer :
Buffer
- .setLBA(lba, hpt, spt) ⇒
CHS
- .getLBA(hpt, spt) ⇒
Number
- .toLBA(hpt, spt) ⇒
Number
- .clone() ⇒
CHS
- .copy(target) ⇒
CHS
- .parse(buffer, [offset]) ⇒
CHS
- .write(buffer, [offset]) ⇒
Buffer
- .toBuffer() ⇒
Buffer
- .fromNumber(value) ⇒
CHS
- .toNumber() ⇒
Number
- .cylinder :
- static
new CHS([cylinder], [head], [sector])
Cylinder-Head-Sector Address
Params
- [cylinder]
Number
|Buffer
= 1023
- [head]
Number
= 254
- [sector]
Number
= 63
Number
chS.cylinder : Cylinder
Kind: instance property of CHS
Number
chS.head : Head
Kind: instance property of CHS
Number
chS.sector : Sector
Kind: instance property of CHS
Buffer
chS.buffer : Get/set values from/to a Buffer
Kind: instance property of CHS
CHS
chS.setLBA(lba, hpt, spt) ⇒ Set CHS to a Logical Block Address (LBA)
Kind: instance method of CHS
Params
- lba
Number
- Logical Block Address - hpt
Number
- Heads per Track - spt
Number
- Sectors per Track
Number
chS.getLBA(hpt, spt) ⇒ Get the Logical Block Address (LBA) corresponding to the given disk geometry
Kind: instance method of CHS
Returns: Number
- lba
Params
- hpt
Number
- Heads per Track - spt
Number
- Sectors per Track
Number
chS.toLBA(hpt, spt) ⇒ Kind: instance method of CHS
Returns: Number
- lba
See: #getLBA()
Params
- hpt
Number
- Heads per Track - spt
Number
- Sectors per Track
CHS
chS.clone() ⇒ Clone the CHS Address
Kind: instance method of CHS
CHS
chS.copy(target) ⇒ Copy this address to a target address
Kind: instance method of CHS
Params
- target
CHS
CHS
chS.parse(buffer, [offset]) ⇒ Parse a given Buffer
Kind: instance method of CHS
Params
- buffer
Buffer
- [offset]
Number
= 0
Buffer
chS.write(buffer, [offset]) ⇒ Write the CHS address to a given buffer
Kind: instance method of CHS
Params
- buffer
Buffer
- [offset]
Number
= 0
Buffer
chS.toBuffer() ⇒ Create a Buffer representation of the CHS Address
Kind: instance method of CHS
CHS
chS.fromNumber(value) ⇒ Set the CHS address from its 24bit integer value
Kind: instance method of CHS
Params
- value
Number
Number
chS.toNumber() ⇒ Get the 24bit integer value of the CHS address
Kind: instance method of CHS
CHS
CHS.fromBuffer(buffer, [offset]) ⇒ Create a CHS Address from a given buffer
Kind: static method of CHS
Params
- buffer
Buffer
- [offset]
Number
= 0
CHS
CHS.fromLBA(lba, hpt, spt) ⇒ Create a CHS Address from a Logical Block Address (LBA)
Kind: static method of CHS
Params
- lba
Number
- Logical Block Address - hpt
Number
- Heads per Track - spt
Number
- Sectors per Track