Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pointers in C

Status
Not open for further replies.

coolerfantasy

Programmer
Mar 12, 2008
14
A2
hi guys
can pointers in " C " point to the BIOS interrupt 10H
and then call this service ?
 
What for? Just use online asm int 10h. Your code is not portable anyway. You could make C pointer to point to int 10h address (0000h:vector table offset + (10 * 4) ?, don't remember right numbers) , but you'd have trouble returning from interrupt call (returns with iret not with ret), I believe :)
 
Int 10H (video) is the scary one. Intel told MS & IBM not to use interrupts 0..1F but that was ignored. You could get a numeric overflow error if the interrupts are not handled correctly.
 
monkhandle , xwb
thank you for reply
asm doesnt accepted with ANSI C
and my project should doned with ANSI C
can you give me a complet program
how to point to the 10H interrupt then call it
thank you .
 
As I said, there is no way you can do that with ANSI C libraries. But your compiler probably provides C functions to achieve that goal, so you don't have to use inline asm (you still need to know details of interrupt call however :)).
Example for Turbo C is near bottom of page
 
thank you monkhandle
I commend your effort
by the way, i found code that do it and tried it
it worked succesfuly , here is it :
------------------------------------------------------
main()
{
char far *scrn = (char far *) 0xB8000000;
short int attribute = 164;
int full_screen = 80 * 25 * 2, loop = 0;
for( ; loop < full_screen; loop += 2 ) {
scrn[ loop ] = 'A';
scrn[ loop + 1 ] = attribute;
}
}
--------------------------------------------------------
it fills screen with character ' A ' blinking red on green
i think
and as you see no headers used , no libraries
I used MS-QC .
 
Well for fiddling with text mode screen you don't need BIOS services. I thought you wanted to make something like switch to graphics video mode. Now try to do that in ANSI C :D
 
monkhandle
yes you allright i'm really need to use pointer
to point and call BIOS 10H service
please if that possible then give me
a completed program even to write one pixel
thank you .
 
Big confusions here.

Int 010h gives access to bios routines that will do things like change the screen mode. Changing the screen mode can be done without bios, but involves a lot of out instructions to the VGA electronics, which is horrendously difficult to get right, and totally hardware-specific, which is why you have the bios to do the job. You can even, if you try hard enough, destroy some screens by bad choices in fiddling with VGA. Bios is beyond the realms of any standard language because it is specific to the hardware of IBM-compatible PCs.

On top of that, DOS provides a higher-level (but still low-level) of control of graphics things through its own interrupts. This is still outside the realms of standard C as C extends beyond PCs running DOS!

According to which graphics or text mode you are using, the VGA's memory will start at B800 or A000. This is a consequence of the VGA's electronics, and is changed when bios does its magic. Merely writing something to A000 won't make a graphics pixel appear instead of text.

ANSI C has to work on any system, irrespective of hardware. The idea of ANSI C is to make code portable to any environment for which a C compiler is available. If you start pointing at bits of memory with specific functions (either screen data memory or pointers to specific interupts) then your code is no longer portable, and you might just as well make use of the facilities your specific environment makes available. In fact, direct references to addresses holding interupt target addresses are going to make your code less portable and harder to understand than merely calling the interupt the way it is supposed to be called, by an int instruction. ANSI C can't do that, because there's no guarantee the system actually has interrupts, but almost any C compiler ought to give you extra features to allow this sort of thing on the system for which the compiler was designed.
 
lionelhill thank you for explaining
however just one success of do grafics
using pointers is good for my project
i only need to do that as a start step
if you can give me the way it will be
kind of you .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top