The document provides an overview of disk I/O in 3 sentences:
It discusses the internal structure and working of floppy and hard disks, including the file directory, clusters, and file allocation table (FAT). The document also covers the various disk file functions in assembly language programming for opening, reading, writing, and closing files.
7. Working of Hard Disk (General)
One cylinder: the same track on the top and bottom of a platter.
8. Disk Access
• The method of accessing information for both
Floppy and Hard Disk is similar.
• This is done with the help of moving heads on
the disk plates.
9. The File Directory
• DOS creates a 32-bit directory for each file. The format of an entry
is as follows:
• Byte 11 is the attribute file. Each bit specifies a file attribute.
(Fig:19.4 , Given on the next slide)
Hidden files ( bit 1) DIR
Archive bit ( bit 5) BACKUP
11. Clusters
• DOS sets aside space for files in clusters.
• Clusters always start with ‘0’ .
• Number of sectors in a cluster in n^2.
(Here ‘n’ is cluster number)
• Byte 26-27 in directory bits (starting positions
of clusters).
• Cluster Size (1024 bytes for 5 ¼ in for DD Disk)
12. The FAT
(File Allocation Table)
FAT provides map for file storage.
FAT entries are 12-bit long.
(for Floppy Disks & 10 MB Hard Disk)
FAT for higher Hard Disks it is 16-bit size.
13. File Processing
• The group of INT 21h Functions are called File
Handle Functions.
• This basically involves following functions:
I. Reading
II.Writing
III.Re-writing
14. What is File Handle ?
• When a file opened or created in a program, DOS
assigns it a unique number called “File Handle”.
• Five Built-In File Handles:
I. Keyboard
II.Screen
III.Error output-screen
IV.Auxiliary device (A Piece of equipment that connect to your
computer)
V.Printer
NOTE: Three additional file handles are also present.
15. File Errors
• If error is occurs then CF=1, and code no
appear in AX.