php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS609-System Programming Assignment No. 5 [Spring 2010]
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
Assignment [Total Marks 10]

Write a C program that will translate a CHS address into a LBA address and display it. Take the CHS information from user and use interrupt 13H/48H to get drive parameters.


Note: Submit .C files only. You have to run this in DOS mode because Windows will not allow you to access hard disk directly.
.
Reply
#2
[B]Find the solution and make changes.[/B]
Code:
#include <bios.h> #include <dos.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> //Structure of result buffer used by extended 13H services. struct RESULTBUFFER { unsigned int size; unsigned int infoflags; unsigned long int cylinders; unsigned long int heads; unsigned long int sectors; unsigned long int locount; unsigned long int hicount; unsigned int bytespersector; unsigned long int configptr; }rb; //If Int 13 returns some value then it will be stored in rb. //Function to get drive parameters void getDriveParameters(unsigned int drive, struct RESULTBUFFER * rbptr) { _AH = 0x48; //Service # _DL = drive ; //Drive number rbptr->size = 30; //Size of result buffer _SI = (unsigned int) rbptr; //Offset address of result buffer geninterrupt (0x13); //Generate Interrupt 13 } void main() { char input[15]; //Will be used to store current cylender, head and sector numbers unsigned long int lba, cylinder, head , sector; clrscr(); //Taking input from user puts ("\nEnter the current Cylinder # : "); gets (input); cylinder = atol(input); puts ("\nEnter the current Head # : "); gets (input); head = atol(input); puts ("\nEnter the current Sector # : "); gets (input); sector = atol(input); //Getting drive parameters of Result buffer using Int 13H/48H getDriveParameters(0x80,&rb); //Now we have No. of heads per cylinder in rb.heads and No. of Sectors per track for the disk in rb.sectors //Now from the following formula we can calculate the LBA index for the selected CHS index lba=( ( cylinder * rb.heads + head ) * rb.sectors ) + sector - 1; printf("\n\nThe LBA Index for current CHS address : %ld",lba); printf("\n\n\n\nPress any key to exit..."); getch(); }
Reply
#3
thanks for the solution. would you like to introduce your self?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SEO in Simple Words: How a VU Student Can Write a Clearer Assignment or Blog Post admin 0 39 11-01-2026, 05:11 AM
Last Post: admin
  Cs403 Assignment 3 Helping material May 8,2010 viki 1 5,280 04-28-2020, 03:19 PM
Last Post: ClaireBeauc
  cs301 assignment no 3 Solution 20 January 2016 Vuhelper 0 11,135 01-20-2016, 03:32 PM
Last Post: Vuhelper
  CS201 Assignment vo 3 Solution 20th January 2016 Vuhelper 2 2,659 01-20-2016, 03:28 PM
Last Post: Vuhelper
  CS101 Assignment no 3 Solution 20th January 2016 Vuhelper 0 2,333 01-20-2016, 03:25 PM
Last Post: Vuhelper
  SOC101 INTRODUCTION TO SOCIOLOGY assignment no 3 Solution 20 January 2016 Vuhelper 0 1,917 01-20-2016, 03:19 PM
Last Post: Vuhelper
  CS402 Assignment No 4 Solution & Discussion Xpert 0 2,151 08-01-2015, 02:33 AM
Last Post: Xpert
  cs101 Assignment No. 1 Solution 21 may spring 2015 semester Xpert 0 2,958 05-21-2015, 12:41 AM
Last Post: Xpert
  Assignment solution eng 301 due date 20 may 2015 rumesa khan 3 4,585 05-20-2015, 01:34 AM
Last Post: Xpert
  PHY301 Circuit Theory Assignment No. 1 idea Solution spring may 2015 semester Xpert 0 1,610 05-15-2015, 03:52 AM
Last Post: Xpert

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support