News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Hardware Interaction Through C-Function Address Founder and Tester

Started by ganeshbala, Jun 14, 2008, 07:56 PM

Previous topic - Next topic

ganeshbala

Hardware Interaction Through C-Function Address Founder and Tester

Function Address Founder and Tester

#include
void my();
void (*my_address)();
void my()
{
printf("
WWW");
}
void main()
{
char far *p;
unsigned seg,off;
my_address=my;
clrscr();
/*****Calling function with the address of my function***/
(*my_address)();
printf("
Address of my=%u",my_address);
printf("
Segment Address=%x",FP_SEG(my_address));
printf("
Offset Address=%x",FP_OFF(my_address));
printf("
Getting address by using segment and offset address");
printf("
Address of
my=%u",MK_FP(FP_SEG(my_address),FP_OFF(my_address)));
getch();
}


Hardware Interaction Through C-Display text using Bios routines

Display text using Bios routines

#include
#include
#include
void main()
{
union REGS in,out,ins,oust;
int i,j,row=0,col=0,colaux;
char sentence[80];
clrscr();
gotoxy(1,1);
printf("ENTER A STATEMENT : ");
gets(sentence);
clrscr();
in.h.ah=0x00;in.h.al=0x12;int86(0x10,&in,&out);
in.h.ah=0x0F;
int86(0x10,&in,&out);
printf("


Video Mode = %u",out.h.al);
printf("
Number Of Chararowers Column On Screen = %u",out.h.ah);
printf("
Page Number = %u

",out.h.bh);
gotoxy(1,1);
printf("%s",sentence);
in.h.ah=0x0D;
in.h.bh=0;
ins.h.ah=0x0C;ins.h.bh=0;
for(i=0;i<15;i++)
{
row=0;col=0;
for(j=0;j<640;j++)
{
in.x.dx=i;
in.x.cx=j;
ins.h.al=i+1;
colaux=col*3; //adjusting text width
if(colaux%640==0)
{
row+=55;
col=0;
}
ins.x.cx=colaux;
ins.x.dx=i*3+150+row;
//adjusting text height;'150':-point where text starts

int86(0x10,&in,&out);
if(out.h.al!=0) int86(0x10,&ins,&oust);
//printf("%u,",out.h.al);
col++;
}
}
getch();
in.h.ah=0x00;in.h.al=3;int86(0x10,&in,&out);
}