



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture handout is for System Programming course. It was provided by Prof. Indubhushan Vijayabhas at Ambedkar University, Delhi. It includes: Disk, Utility, Include, Signed, Char, Int, Quick, Format, Partition
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




#include <stdio.h> #include <dos.h> #include <bios.h> #include <alloc.h> typedef struct tagfcb { unsigned char filename [8]; unsigned char ext[3]; unsigned char attrib; unsigned char reserved [10]; unsigned int time,date; unsigned int firstcluster; unsigned long int size; }FCB; typedef struct tagBPB { unsigned int byte spersec; unsigned char secperclust; unsigned int reservedsecs; unsigned char fats; unsigned int rootdirents; unsigned int smallsecs; unsigned char media;
unsigned int fatsecs; unsigned int secspertrack; unsigned int heads; unsigned long int hiddensecs; unsigned long int hugesecs; unsigned char driveno; unsigned char reserved; unsigned char bootsignature; unsigned long int volumeid; unsigned char volumelabel[11]; unsigned char filesystem[8]; }BPB;
struct bootblock { unsigned char jumpinst[3]; unsigned char osname[8]; BPB bpb; unsigned char code[448]; };
DPB far * getdpb(int drive) { DPB far *dpb=(DPB far *)0; _asm push ds; _asm mov ah,0x _asm mov dl,byte ptr drive; _asm mov dx,ds; _asm int 0x21; _asm pop ds _asm cmp al,0xff _asm je finish _asm mov word ptr dpb+2,dx _asm mov word ptr dpb,bx return dpb; finish: return ((DPB far *)(0)); }
void main (void) { unsigned char filename[9]; struct bootblock bb; unsigned char ext[4]; FCB * dirbuffer; unsigned int * FAT; DPB d; DPB far * dpbptr; int i,flag; unsigned int cluster; puts("Enter filename:"); gets (filename); puts("Enter Extension"); gets(ext); if ((absread(0x05,1,0, &bb))==0) puts ("Success"); else{ puts("Failure"); exit(0); }