问题
What is the order int 13h
with ah=02h
will read 19
sectors starting at (C, H, S) = (0, 0, 1)
provided a (floppy) disk geometry of 2 heads, 18 sectors per track and 80 tracks per side.
Or, more generally, what happens when it reaches the end of track 0, head 0? Does it go to track 1 or head 1? Does it even work properly in this case?
EDIT: Wait.. is this actually like hours, minutes, seconds? If we reach the end of the track (S is greater than 18), then H is increased?
回答1:
Modern BIOSes support the concept of multitrack1 reads and writes. If you read or write past the end of a track it will continue on with the following track. To be most compatible with the widest array of BIOSes (old and new) you may wish to consider not reading or writing across a track boundary.
With a drive geometry of 18 sector per track/2 heads/80 cylinders (3.5" 1.44MB floppy), the sector after CHS(0,0,18) is CHS(0,1,1). After you reach sector at CHS(0,1,18) the next one is CHS(1,0,1). In a way this is similar HH:MM:SS.
With your drive geometry there are a total of 2880(80*2*18) sectors. If you number the sectors from 0 to 2879 (inclusive) they are called the logical block addresses (LBA).
Int 13h/ah=2 takes CHS values. You can convert an LBA to CHS values with the formula (or equivalent):
C = (LBA ÷ SPT) ÷ HPC H = (LBA ÷ SPT) mod HPC S = (LBA mod SPT) + 1 HPC = Heads per cylinder (aka Number of Heads) SPT = Sectors per Track, LBA = logical block address "mod" is the modulo operator (to get the remainder of a division)
I have written more about the LBA to CHS calculation in this other Stackoverflow answer in the section Translation of LBA to CHS. If you created a table using these calculations, the numbering would look like:
LBA = 0: CHS = ( 0, 0, 1) LBA = 1: CHS = ( 0, 0, 2) LBA = 2: CHS = ( 0, 0, 3) LBA = 3: CHS = ( 0, 0, 4) LBA = 4: CHS = ( 0, 0, 5) LBA = 5: CHS = ( 0, 0, 6) LBA = 6: CHS = ( 0, 0, 7) LBA = 7: CHS = ( 0, 0, 8) LBA = 8: CHS = ( 0, 0, 9) LBA = 9: CHS = ( 0, 0, 10) LBA = 10: CHS = ( 0, 0, 11) LBA = 11: CHS = ( 0, 0, 12) LBA = 12: CHS = ( 0, 0, 13) LBA = 13: CHS = ( 0, 0, 14) LBA = 14: CHS = ( 0, 0, 15) LBA = 15: CHS = ( 0, 0, 16) LBA = 16: CHS = ( 0, 0, 17) LBA = 17: CHS = ( 0, 0, 18) LBA = 18: CHS = ( 0, 1, 1) LBA = 19: CHS = ( 0, 1, 2) LBA = 20: CHS = ( 0, 1, 3) LBA = 21: CHS = ( 0, 1, 4) LBA = 22: CHS = ( 0, 1, 5) LBA = 23: CHS = ( 0, 1, 6) LBA = 24: CHS = ( 0, 1, 7) LBA = 25: CHS = ( 0, 1, 8) LBA = 26: CHS = ( 0, 1, 9) LBA = 27: CHS = ( 0, 1, 10) LBA = 28: CHS = ( 0, 1, 11) LBA = 29: CHS = ( 0, 1, 12) LBA = 30: CHS = ( 0, 1, 13) LBA = 31: CHS = ( 0, 1, 14) LBA = 32: CHS = ( 0, 1, 15) LBA = 33: CHS = ( 0, 1, 16) LBA = 34: CHS = ( 0, 1, 17) LBA = 35: CHS = ( 0, 1, 18) LBA = 36: CHS = ( 1, 0, 1) LBA = 37: CHS = ( 1, 0, 2) LBA = 38: CHS = ( 1, 0, 3) LBA = 39: CHS = ( 1, 0, 4) LBA = 40: CHS = ( 1, 0, 5) LBA = 41: CHS = ( 1, 0, 6) ... [snip] ... LBA = 2859: CHS = (79, 0, 16) LBA = 2860: CHS = (79, 0, 17) LBA = 2861: CHS = (79, 0, 18) LBA = 2862: CHS = (79, 1, 1) LBA = 2863: CHS = (79, 1, 2) LBA = 2864: CHS = (79, 1, 3) LBA = 2865: CHS = (79, 1, 4) LBA = 2866: CHS = (79, 1, 5) LBA = 2867: CHS = (79, 1, 6) LBA = 2868: CHS = (79, 1, 7) LBA = 2869: CHS = (79, 1, 8) LBA = 2870: CHS = (79, 1, 9) LBA = 2871: CHS = (79, 1, 10) LBA = 2872: CHS = (79, 1, 11) LBA = 2873: CHS = (79, 1, 12) LBA = 2874: CHS = (79, 1, 13) LBA = 2875: CHS = (79, 1, 14) LBA = 2876: CHS = (79, 1, 15) LBA = 2877: CHS = (79, 1, 16) LBA = 2878: CHS = (79, 1, 17) LBA = 2879: CHS = (79, 1, 18)
Footnotes:
1Multitrack support doesn't mean a disk access can cross cylinders. A multitrack disk access must start and end on the same cylinder.
来源:https://stackoverflow.com/questions/54313624/reading-more-sectors-than-there-are-on-a-track-with-int-13h