C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-28-2002, 12:58 PM   #1
Registered User
 
Join Date: Mar 2002
Posts: 1
hardware interaction in c

hi there,
this is vineet.i am in MCA fourth sem.planning to submit "system manager for dos" as a minor project,which would provide a GUI for formatting(A drive),scanning and many other utilities.but i am facing a lot of problems.it would be really nice of u if u could help me with the following..

1-->how can i provide information about all the partition's on the sytem i.e. it's free and used space.

2-->How can i show exat RAM size used(it's 192 in mine).

3-->it would be really nice of u if u could provide me information about media discreptor of floppy(1.44MB).

vineet..
vineetwadwekar is offline   Reply With Quote
Old 03-28-2002, 01:44 PM   #2
Code Warrior
 
Join Date: Nov 2001
Posts: 669
Lightbulb

At first you should write what compiler do you use and in which operating system are you writing your code.
__________________
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
GaPe is offline   Reply With Quote
Old 03-28-2002, 02:38 PM   #3
....
 
Join Date: Aug 2001
Location: Groningen (NL)
Posts: 2,386
>system manager for dos

I assume you're using DOS. You could use the info in the BIOS.
Shiro is offline   Reply With Quote
Old 03-28-2002, 11:55 PM   #4
Registered User
 
Nutshell's Avatar
 
Join Date: Jan 2002
Posts: 1,020
How can i use the info in the BIOS? DOn't u need assembly stuff do access the partition table and things like that?
Nutshell is offline   Reply With Quote
Old 03-29-2002, 01:19 AM   #5
Im a Capricorn
 
vsriharsha's Avatar
 
Join Date: Feb 2002
Posts: 192
Thumbs up

> How can i use the info in the BIOS? DOn't u need assembly stuff do access the partition table and things like that?

In the first case, No assembly is required to access partition table information and any of the Hardware resource information for that matter. C (I use Turbo C) provides u a rich set of functions to do the same for some and for the others u always have memory under ur spell, so get the values from various memory locations. U can also have information from CMOS using the system CMOS ports 70h & 71h.
For partition table...

The hard disk is partitioned using utilities like DOS's FDISK. While partitioning the hard disk, FDISK stores the details like where one partition ends and the next begins, which is the bootable partition etc in the first physical sector (side 0, track 0 sector 1). It also stores a program called Master Boot Program in the PT (partition table). Thus a PT consists of a data part and the code part. This is how the PT is logically divided...

Code Part Data Data 55
(master boot program) data data AA
-------------- ----------------------- -----------
446 bytes 64 bytes 2 bytes
totally : 512 bytes

The data part begins at the 447th byte. the last 2 bytes in the PT are always 0x55, 0xAA. The data part is 64 bytes long and is further divided into 4 16-bit chunks. Each chunk consists of info abt a partition on the HDD. Hence there can be maximum four partitions on the HDD. (dont confuse with logical drives which can by any number). The break up for those 16-byte chunks are ...

Byte Meaning
----- -----------
0 Boot Indicator. Contains 0x80 for active partition and 0
otherwise.Only 1 partition can be active at a time
1 Side where partition begins
2 Low-six bits are the sector where partition begins
Two-high bits are the two high bits of the track where
partition begins
3 Low order 8 bits of the track where partition begins
4 Partition type indicator. The following values may exist...
0 - Unused partition
1 - DOS partition using 12-bit FAT
2 - Unix Partition
4 - DOS partition using 16-bit FAT
5 - Extended partition
6 - Huge Partition
5 Side where partition ends
6 Low-six bits are the sector where partition ends
Two-high bits are the two high bits of the track where
partition ends
7 Low order 8 bits of the track where partition ends
8-11 Double word containing the number of sectors preceding
the partition. Low order word is stored first
12-15 Double word containing the number of sectors in
the partition. Low order word is stored first


So, with these details, go ahead and try a program off ur brains... But remember (There is no mention for 32-bit FAT or Linux native / swap partitions. So, this is a premitive stuff (not suited for the latest partitions), so just be careful)


Best regards,
Sriharsha.

*Note: Dont play with ur PT or else U have to reset the whole disk.
__________________
Help everyone you can
vsriharsha is offline   Reply With Quote
Old 03-29-2002, 01:30 AM   #6
Registered User
 
Nutshell's Avatar
 
Join Date: Jan 2002
Posts: 1,020
What are the functions that can access the partition table?
Nutshell is offline   Reply With Quote
Old 03-29-2002, 09:01 AM   #7
Im a Capricorn
 
vsriharsha's Avatar
 
Join Date: Feb 2002
Posts: 192
I never remember using any Off-the shelf functions. I always wrote it on my own.
I guess u can do it with the info i provided above.
__________________
Help everyone you can
vsriharsha is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hardware interaction through USB port with C mariano_donati C Programming 3 11-15-2007 07:31 PM
How does hardware interpret data? Silvercord Tech Board 3 01-29-2003 01:46 PM
Linux Hardware Handbook Nutshell A Brief History of Cprogramming.com 0 04-02-2002 06:06 AM
C++ Hardware Interaction William C Programming 1 03-28-2002 03:52 AM
support 256 colors... jackie_islam C Programming 4 03-12-2002 01:29 PM


All times are GMT -6. The time now is 10:21 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22