assembly language programming basics
TRANSCRIPT
Presentation (Assembly Language Programming)Topic:
Disk I/OPresented To:
Mam. Shaziya SaqibPresented By:
Section-B(4rth Semester)
Department of Computer ScienceLahore Garrison University
(Walton Campus)
Introduction to Disk I/O
Types of Storage
I. Hard Disk
II.Floppy Disk
III.There Models (Given on next slides)
IV.Working Area
Models of Floppy and Hard Disks
DD Disk holds 720k of data & HD Disk holds 2.0 MB of data.
Working of Floppy Disk ( 5 ¼ In)
Working of Floppy Disk (3 ¼ In)
Working of Hard Disk (General)
One cylinder: the same track on the top and bottom of a platter.
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.
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
Attribute File
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)
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.
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
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. KeyboardII. ScreenIII.Error output-screenIV.Auxiliary device (A Piece of equipment that connect to your
computer)
V.Printer NOTE: Three additional file handles are also present.
File Errors
• If error is occurs then CF=1, and code no appear in AX.
Opening a File
Opening a File(Example)
• Write instructions to open a new read_only file called FILE1.
Open an Existing File
• To open an existing file, there is an another function:
Closing a File
• After a file has been processed, it should be closed.
Reading a file
• The following function reads a specified number of bytes from a file and stores them in memory.
Reading a file(Example)
• Write some code to read a 512-byte sector from a file.
Writing a File
• Function 40h writes a specified number of bytes to a file or device.
Writing a File(Example)
• Use function 40h to display a message on the screen.
File Pointer
File Pointer(Example)
Summary
• Today we discuss about:Internal structure & working of both Floppy &
Hard Disk.The File Directory.Cluster & FATDisk File Functions1) 3Ch 2) 3Dh 3) 3Eh4) 3Fh 5) 40h 6) 42h
Any Question ???