Download - Assembly Language Programming Basics
![Page 1: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/1.jpg)
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)
![Page 2: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/2.jpg)
Introduction to Disk I/O
![Page 3: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/3.jpg)
Types of Storage
I. Hard Disk
II.Floppy Disk
III.There Models (Given on next slides)
IV.Working Area
![Page 4: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/4.jpg)
Models of Floppy and Hard Disks
DD Disk holds 720k of data & HD Disk holds 2.0 MB of data.
![Page 5: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/5.jpg)
Working of Floppy Disk ( 5 ¼ In)
![Page 6: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/6.jpg)
Working of Floppy Disk (3 ¼ In)
![Page 7: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/7.jpg)
Working of Hard Disk (General)
One cylinder: the same track on the top and bottom of a platter.
![Page 8: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/8.jpg)
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.
![Page 9: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/9.jpg)
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
![Page 10: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/10.jpg)
Attribute File
![Page 11: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/11.jpg)
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)
![Page 12: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/12.jpg)
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.
![Page 13: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/13.jpg)
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
![Page 14: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/14.jpg)
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.
![Page 15: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/15.jpg)
File Errors
• If error is occurs then CF=1, and code no appear in AX.
![Page 16: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/16.jpg)
Opening a File
![Page 17: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/17.jpg)
Opening a File(Example)
• Write instructions to open a new read_only file called FILE1.
![Page 18: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/18.jpg)
Open an Existing File
• To open an existing file, there is an another function:
![Page 19: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/19.jpg)
Closing a File
• After a file has been processed, it should be closed.
![Page 20: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/20.jpg)
Reading a file
• The following function reads a specified number of bytes from a file and stores them in memory.
![Page 21: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/21.jpg)
Reading a file(Example)
• Write some code to read a 512-byte sector from a file.
![Page 22: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/22.jpg)
Writing a File
• Function 40h writes a specified number of bytes to a file or device.
![Page 23: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/23.jpg)
Writing a File(Example)
• Use function 40h to display a message on the screen.
![Page 24: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/24.jpg)
File Pointer
![Page 25: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/25.jpg)
File Pointer(Example)
![Page 26: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/26.jpg)
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
![Page 27: Assembly Language Programming Basics](https://reader034.vdocument.in/reader034/viewer/2022051007/5a657c387f8b9a931a8b5fa1/html5/thumbnails/27.jpg)
Any Question ???