|
-
Oct 28th, 2002, 12:46 PM
#1
Thread Starter
Junior Member
Hardware interaction in C
Hi guys,
I have recently completed my fair knowledge with C.
I also have alittle idea about BIOS-interrupt,how they can be used [ex:int86()] for manipulation or accessing various hardware information.Hence I want to learn more about this.
Can anyone recommend good books or links that can explain me or give me an indepth knowlegde of this fascinating thing?
I will be greatful to you.
Thanks.
Bye.
-
Oct 28th, 2002, 12:57 PM
#2
Monday Morning Lunatic
They're very unhelpful to you because they're now forbidden in most OS's.
I'd suggest learning some of the services a good OS gives you, direct hardware access in any decent system requires kernel privileges.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 28th, 2002, 01:04 PM
#3
Thread Starter
Junior Member
Wow parksie that was a quick reply 
But can you please be a more detail about the thing you want to say?I didn't get you properly.
Sorry.
-
Oct 28th, 2002, 01:17 PM
#4
Monday Morning Lunatic
What sort of hardware interaction were you thinking of?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 28th, 2002, 03:52 PM
#5
Frenzied Member
Some things:
Programming those DOS interrupts requires ASM sometimes.
You cannot get to those interrupts in NT, Win2K, XP. You have to use the OS intervening calls or use libraries, like WMI.
Code that uses them will be pretty much unusable in about four years when support for the last consumer Windows version (Win ME) goes away.
Then it'll be like having written code for a prime computer or for DOS 6.0 - there are still people who use these boxes/OS'es, but they don't buy software, except maybe at a flea market.
-
Oct 29th, 2002, 12:59 AM
#6
Thread Starter
Junior Member
Originally posted by parksie
What sort of hardware interaction were you thinking of?
Like getting the printer status,setting time/date in CMOS chip etc..etc. (BTW, I don't know much more )
Also if these things are not possible in C (or may get outdated)..then is there any other language that can help me to achieve these sort of things.What do I need to learn?
-
Oct 29th, 2002, 03:17 AM
#7
Monday Morning Lunatic
It's not the language you need to worry about.
For setting the time and date, you use the API of the OS you're running under; that's what it's there for. For printing, that's pretty much OS-dependent as well.
A lot of this is to shield the programmer from variations in hardware - the OS gives a single coherent interface, and handles the nasty details itself (you're not allowed to do it yourself most of the time).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 29th, 2002, 03:03 PM
#8
It's called protection.
Do you remember the DOS and Win16 days, when every faulty app would make your PC crash completly so that you would have to reboot?
Programmers had hard times back then, especially game programmers. I admit I didn't program, I was about 10 years old. But I remember the long setup sessions setting the sound IRQ, testing, failing, setting another IRQ, testing, crashing...
All of it because programmers had to access hardware directly to work with it.
Today's operating systems have device dirvers to handle that nasty part. They expose the functionality through their API. No other means of accessing hardware are allowed. Why? Because it makes the system more stable. If an app changes hardware settings and then crashes the OS won't be able to recover from it. If the app only uses the API then the OS can monitor and intercept, or use collected info to better recover from errors.
The nearest you get to hardware these days is using DirectX, but this too is already 3 layers above hardware.
All in all you can trust me, it's a good thing. As parksie said you are better off learning the API of windows, MacOS, POSIX and/or some XWin variant. You can then program for windows or for POSIX systems (GNU/Linux, FreeBSD, NetBSD...).
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 30th, 2002, 11:31 AM
#9
Thread Starter
Junior Member
So what actually is API?
-
Oct 30th, 2002, 11:43 AM
#10
Addicted Member
The API is the Application Programming Interface.
It defines the functions, their parameters and return values etc. For example, the Windows API functions include those to manipulate the registry etc.
HD
-
Oct 30th, 2002, 12:31 PM
#11
Monday Morning Lunatic
An API is more generic than that though, for example Windows has an API, Unix has an API, Photoshop has one, etc.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 30th, 2002, 12:42 PM
#12
You can compare an API to cpu instructions. cpu instructions are the things you can tell the cpu to do. The API functions are the things you can tell some higher level (an operating system or even some application) to do.
Every OS has it's API, as does every application that can be extended with plug-ins (Photoshop, 3DSMAX, IE, Mozilla, Winamp, just to name VERY few). It's the means by which the application or OS communicates with your code.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 31st, 2002, 07:29 AM
#13
Thread Starter
Junior Member
Great 
But from where do I learn it ?
-
Oct 31st, 2002, 07:34 AM
#14
Monday Morning Lunatic
Which one are you interested in learning?
What OS, compiler?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 1st, 2002, 07:39 AM
#15
Thread Starter
Junior Member
Anyone thats the best, and can help in future.
-
Nov 1st, 2002, 08:02 AM
#16
Monday Morning Lunatic
Get a Unix system then. Either GNU/Linux or one of the free BSDs (www.openbsd.org, www.freebsd.org, www.netbsd.org).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 4th, 2002, 05:10 AM
#17
Anyone thats the best, and can help in future.
parksie:
Get a Unix system then.

True, but funny anyway.
But, as anyone can tell you, there's not really a "best" OS. At least not for a programmer. Programming for UNIX gives you a stable system with a good-looking future, portable code and a great open source base for code reviewers or example code. Programming for Windows gives you a LAAAAAAAAAARGE user base.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|