Logical block addressing (LBA) is a common scheme used for specifying the location of blocks of data stored on computer storage devices, generally secondary storage systems such as hard disks.
Cylinder-head-sector
Cylinder-head-sector, also known as CHS, was an early method for giving addresses to each physical block of data on a hard disk drive. In the case offloppy drives, for which the same exact diskette medium can be truly low-level formatted to different capacities, this is still true.
If you look at most sites they will give you this set of formulas:
Sector = (LBA mod SectorsPerTrack)+1
Cylinder = (LBA/SectorsPerTrack)/NumHeads
Head = (LBA/SectorsPerTrack) mod NumHeads
Sector = (LBA mod SectorsPerTrack)+1
Cylinder = (LBA/SectorsPerTrack)/NumHeads
Head = (LBA/SectorsPerTrack) mod NumHeads
Simple Assembly example:
(This is not likely to work if you cut and paste it and is here to show the principle only, look at the next section for a complete example)LBACHS: ; Set up the registers ready for the divide MOV ax, [LBAvalue] ; []'s means value at memory location LBAvalue. ; Make the divide DIV [SectorsPerTrack] ; Carry out the division of ax. ; Put the returned Number Of Tracks some where MOV [NumTracks], ax ; Put the quotient into a memory variable ; Sort out the sector value INC dx ; Add 1 to the remainder MOV [Sector], dx ; Put the remainder into a memory variable ; Set up the registers ready for the divide MOV ax, [NumTracks] ; Put the number of tracks in to ax ; Make the divide DIV [NumHeads] ; Divide NumTracks (ax) by NumHeads ; Stash the results in some memory locations MOV [Cylinder], ax ; Quotient value, the Number of heads to be moved from ax MOV [Head], dx ; Remainder value, the cylinder value to be oved from dx
Tidak ada komentar:
Posting Komentar