Section 4.14 question: how to calculate the physical sector number based on the Logical sector number of a floppy disk?

Source: Internet
Author: User
Author: Maverick Blog:Http://blog.csdn.net/zhaohuabing reprinted please indicate the source

I. First, let's look at the physical structure of the floppy disk.
A floppy disk has a cylindrical, a magnetic, and a sector structure physically. The relationship between a floppy disk and a magnetic track is that the disk contains a sector, which is the basic unit for the computer to read a floppy disk.
1. cylindrical Disk: the floppy disk has two cylindrical disks numbered 0, 1 (two sides of the floppy disk)
2. Track: each plane is divided into several tracks, ranging from 0, 1, 2... 80.
3. Sector: each track is divided into several sectors. The number of sectors in a track is 1, 2, 3... 18. Each sector has the same capacity and can store 512 bytes of data.

2. Check the encoding of the slice.
There are two types of slice numbers: physical numbers and logical numbers.

1. Physical number: indicates the physical location of the sector on a floppy disk. It is represented by a cylindrical disk, track, or sector. If the BIOS interrupts INT 13 H, the physical number is used to determine the location of the sector to be read.
2. Logical ID: indicates the logical position of the slice. It is the sequence number relative to the starting slice (cylindrical 0 track 0 sector 0 ).

3. the correspondence between physical numbers and logical numbers is as follows:
Physical ID (cylindrical ID, track number, Fan area number), logical ID
0 cylinder 0 track 0 0 1 0
0 0 2 1
............
0 0 18 17
1 cylindrical 0 track 1 0 1 18
1 0 2 19
............
1 0 18 35
0 cylinder 1 track 0 1 1 28
0 1 2 29
............
0 1 18 53
1 cylinder 1 track 1 1 1 54
1 1 2 55
............
1 1 18 71
..................
0 cylinder 79 track 0 79 1
0 79 2
.........
0 79 18
1 cylindrical 79 track 1 79 1
1 79 2
............
1 79 18 2879
We can see that the logic sector number is encoded in the sequence of physical sector numbers, physical cylinder numbers, and physical channels. Why do we need to follow this sequence, I think it is mainly to reduce the movement of the head and speed up the I/O of the floppy disk. Because files are generally stored in the adjacent logical sector, and the logical sector is encoded according to the sequence of the physical sector code, physical cylinder number, and physical track number, the adjacent logical sector is also adjacent to the physical location of the floppy disk (the same side or the other side), which can reduce the moving distance from reading the same file head.
The Conversion Relationship Between the two numbers is as follows:
Logical sector number = (Track number * 2 + Cylinder Number) * 18 + Physical sector number-1

Because each track has 18 sectors, and the physical fan area number starts from 0 on each track, the physical fan area number = the remainder of the logical fan area number/18 + 1
Because each track has 18*2 sectors, so the track number = logical fan area number/(18*2) of the business is the track number = business> 2
If the operator of the logical sector number/18 is an even number, it is the cylindrical 0. If the operator is an odd number, it is the cylindrical 1, that is, the cylindrical number = Operator & 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.