Partner Link

Cheap Mobile Phones
- Cheap Mobile Phones - Best Mobile Phone Deals, Laptops, Sat Nav Devices, Cordless Phones, Internet Phones, Broadband Internet Deals from leading retailers of UK. Choose Products and Compare Prices for best deals.

||

Mobile Phones
- Offers mobile phones on contract, pay as you go, sim free deals with free gifts. We compare latest phone deals from leading retailers of UK.

. ||

Custom logo design
Get your company a logo design. Professional logo designs by expert logo designers. Call 0208 133 2514 for custom logo design packages.

||

Top Site

Flyer Printing Flyer Printing – Print your flyers on latest design. We offer cheap flyer printing services in all over UK. Full color flyer printing & art work in your own budget. Order for online flyer printing from your home.
Mobile Broadband Deals  Mobile Broadband - Buy Mobile Broadband Deals, Best Mobile Internet Offers With Free Line Rental, USB Modem and Cheapest Network Connection Offers from 3 Mobile in UK
Mobile Upgrades Upgrade Mobile Phone Deals – upgrade your mobile phones from o2, orange, virgin, vodafone, t-mobile and all Manufacturers Nokia, Samsung, Sony Ericsson, LG ,Blackberry and Motorola. Mobile Broadband Deals Mobile Broadband - Buy Mobile Broadband Deals, Best Mobile Internet Offers With Free Line Rental, USB Modem and Cheapest Network Connection Offers from 3 Mobile in UK.

C language program Lecture 3

This same task can be performed by the following program as well. In this case the video text memory is accessed byte by byte.

unsigned char far *scr=(unsigned char far*)0xb8000000;
void main()
{
*scr=0x56;
*(scr+1)=0x07;
*(scr+2)=0x55;
*(scr+3)=0x70;
}

The next example fills whole of the screen with spaces. This will clear the contents of the screen.

unsigned char far *scr=(unsigned char far*)0xb8000000; //corrected
void main()
{
int i; //instruction added
for (i=0;i<2000;i++) scr="0x20;" scr="scr+2;">void interrupt (*old)();
void interrupt newfunc();
char far *scr=(char far* ) 0xb8000000;
void main()
{

old=getvect(0x08);
setvect(0x08,newfunc);

keep(0,1000);
}
void interrupt newfunc ()
{
*scr=0x41; //corrected
*(scr+1)=0x07; //corrected

(*old)();

}

In the above example the timer interrupt is intercepted such that whenever the timer interrupt is invoked (by means of hardware) the memory resident newfunc() is invoked. This function simply displays the ASCII character 0x41 or ‘
A’ in the top left corner of the text screen.

Here is another example.

#include
void interrupt (*old)();
void interrupt newfunc();
char far *scr=(char far* ) 0xb8000000;

int j;
void main( )
{
old=getvect(0x08);
setvect(0x08,newfunc); //corrected

keep(0,1000); //corrected
}

void interrupt newfunc ( )
{

for ( j=0;j<4000;j+=2){>
if(*(scr+j)==‘1’){
*(scr+j)=‘9’; }
}
(*old)();
}

This program scans through all the bytes of text display memory when int 8 occurs. It once resident will replace all the ‘1’ on the screen by ‘9
’. If even somehow a ‘1’ is displayed on the screen it will be converted to ‘9’ on occurrence of interrupt 8 which occurs 18.2 times every second.

The keyboard Interrupt
Keyboard is a hardware device and it makes use of interrupt number 9 for its input operations. Whenever a key is pressed interrupt # 9 occurs. The operating system processes this interrupt in order to process the key pressed. This interrupt usually reads the scan code from the keyboard port and converts it into the appr
opriate ASCII code and places the ASCII code in the keyboard buffer in BIOS data area as described I nthe diagram belowLets now experiment on the keyboard interrupt to understand its behavior

Example

#include
void interrupt (*old)( );
void interrupt newfunc( );

void main( )
{
old = getvect(0x09);

setvect(0x09,newfunc);
keep(0,1000);
}
void interrupt newfunc ( )
{
(*old)( );
(*old)( );

(*old)( );
}

This program simply intercepts the keyboard interrupt and places the address of newint in the IVT. The newint simply invokes the origin
al interrupt 9 thrice. Therefore the same character input will be placed in the keyboard buffer thrice i.e three characters will be received for each character input.

Example

#include
void interrupt (*old)( );
void interrupt newfunc( );

char far *scr = (char far* ) 0x00400017;

void main( )
{
old = getvect(0x09);
setvect(0x09,newfunc);

keep(0,1000);
}
void interrupt newfunc ( )
{
*scr = 64;
(*old)( );
}

The above program is quite familiar it will just set the caps lock status whenever a key is pressed. In this case the keyboard interrup
t is intercepted.

Example

void interrupt (*old)( );
void interrupt newfunc( );
char far *scr = (char far* ) 0xB8000000;

int j;
void main( )
{
old = getvect(0x09);
setvect(0x09,newfunc);
keep(0,1000);
}
void interrupt newfunc ( )
{ for( j = 0;j <>
the keyboard the newfunc functions runs through whole of the test display memory and replaces the ASCII ‘1’ displayed by ASCII ‘9’. Timer & Keyboard Interrupt Program #include
void interrupt (*oldTimer)( ); //corrected
void interrupt (*oldKey)( ); //corrected
void interrupt newTimer ( );
void interrupt newKey ( );
char far *scr = (char far* ) 0xB8000000
;
int i, t = 0, m = 0;
char charscr [4000];
void main( )
{
oldTimer = getvect(8);
oldKey = getvect (9);
setvect (8,newTimer);
setvect (9,newKey);
getch();

getch();
getch();
getch();
}

void interrupt newTimer ( )
{
t++;
if ((t >= 182) && (m == 0))
{

for (i =0; i < i ="0;" t =" 0;" m =" 1;" m ="="" w ="0;" m =" 0;">y and fills the screen with spaces and sets a flag m. The newKey function is invoked when a key press occurs. The flag is checked if the it’s set then the screen is restored from the values saved in that character array. Reentrant Procedures & Interrupt If on return of a function the values within the registers are unchanged as compared to the values which were stored in registers on entry into the procedures then the procedure is called reentrant procedure. Usually interrupt procedures are reentrant procedures especially those interrupt procedure compiled using C language compiler are reentrant. This can be understood by the following example
In the above example the function Proc1() is invoked. On invocation the register AX contained the value 1234H, the code within the function Proc1() changes the value in AX to FF55H. On return AX will contain the value 1234H if the function have been implemented as a reentrant procedure i.e a reentrant procedure would restore the values in registers their previous value (saved in the stacked) before returning.
C language reentrant procedures save the registers in stack following the order AX, BX, CX, DX, ES, DS, SI, DI, BP on invocation and restores in reverse order before return.

This fact about reentrant procedures can be analysed through following example.

#include
void interrupt *old();
void interrupt newint()
void main ()
{
old = getvect(0x65);
setvect(0x65,newint);
_AX=0xf00f;
geninterrupt(0x65);
a = _AX
printf(“%x”,a);
}
void interrupt newint()
{
_AX=0x1234;
}


Firstly its important to compile this above and all the rest of the examples as .C files and not as .CPP file. It these codes are compiled using .CPP extension then there is no surety that this program could be compiled.
Again int 65H is used for this experiment. The int 65H vector is made to point at the function newint(). Before calling the interrupt 65H value 0xF00F is placed in the AX register. After invocation of int 65H the value of AX register is changed to 0x1234. But after return if the value of AX is checked it will not be 0x1234 rather it will be 0xF00F indicating that the values in registers are saved on invocation and restore before return and also that the interrupt type procedures are reentrant.

12 comments:

Anonymous said...

My partner and I absolutely love your blog and find
nearly all of your post's to be precisely what I'm looking for.

Do you offer guest writers to write content to suit your needs?
I wouldn't mind writing a post or elaborating on a number of the subjects you write with regards to here. Again, awesome web site!

Also visit my weblog - 6th ave electronics credit card

Anonymous said...

Hi there. Sorry to trouble you but I happened to run across your blog website and noticed you're using the exact same theme as me. The only problem is on my blog, I'm unable to get the page layout
looking like yours. Would you mind emailing me at: monique_person@gmail.

com so I can get this figured out. By the
way I have bookmarked your website: http:
//www.blogger.com/comment.g?blogID=659615463907098886&postID=6276814192990197013 and
will be visiting often. Thankyou!

Feel free to visit my weblog ... vrbo michigan dunes

Anonymous said...

Hello! Do you use Twitter? I'd like to follow you if that would be ok. I'm undoubtedly enjoying your blog and
look forward to new updates.

Feel free to surf to my web-site: vacation rental by owner marathon fl

Anonymous said...

Hi are using Wordpress for your site platform?
I'm new to the blog world but I'm trying to get started and set up my own.
Do you require any coding expertise to make your own blog?
Any help would be greatly appreciated!

Here is my web-site :: memory card for xbox 360 kinect

Anonymous said...

Fascinating blog! Is your theme custom made or did you download
it from somewhere? A design like yours with a few simple tweeks
would really make my blog stand out. Please let me know where
you got your theme. Many thanks

Feel free to surf to my website: frigidaire dishwasher

Anonymous said...

Howdy! Do you know if they make any plugins to help with SEO?

I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good
success. If you know of any please share. Thank you!



Here is my web site - home appliances philippines

Anonymous said...

hello there and thank you for your information
– I've definitely picked up anything new from right here. I did however expertise some technical points using this web site, as I experienced to reload the web site a lot of times previous to I could get it to load properly. I had been wondering if your web host is OK? Not that I'm complaining, but slow loading instances
times will often affect your placement in
google and could damage your high quality score if ads and marketing with Adwords.
Anyway I'm adding this RSS to my e-mail and can look out for much more of your respective intriguing content. Ensure that you update this again soon.

my webpage journals.fotki.com

Anonymous said...

I'm curious to find out what blog platform you happen to be utilizing? I'm
experiencing some minor security problems with
my latest site and I'd like to find something more risk-free. Do you have any solutions?

My web blog harkins theaters

Anonymous said...

Heya! This is the third time visiting now and I really just wanted to say
I truley enjoy looking at your website. I decided to bookmark it at reddit.
com with your title: Blogger: Computer Network Graphics and your Website address: http://www.
blogger.com/comment.g?blogID=659615463907098886&postID=6276814192990197013.
I hope this is fine with you, I'm attempting to give your great blog a bit more visibility. Be back shortly.

My web-site :: www thottbot com

Anonymous said...

We stumbled over here from a different page and thought
I might as well check things out. I like what I see so now i
am following you. Look forward to exploring your web page again.


my web blog; kitchen appliance packages hhgregg

Anonymous said...

This design is steller! You certainly know how to keep a reader amused.
Between your wit and your videos, I was almost moved to start my own
blog (well, almost...HaHa!) Excellent job. I really loved what
you had to say, and more than that, how you presented it. Too cool!


Also visit my homepage; how to paint kitchen appliances

Anonymous said...

I comment when I appreciate a post on a site
or I have something to add to the discussion. Usually it's a result of the passion displayed in the article I looked at. And after this article "C language program Lecture 3". I was actually excited enough to leave a commenta response :) I actually do have 2 questions for you if you tend not to mind. Could it be simply me or does it look like like a few of the remarks appear like coming from brain dead individuals? :-P And, if you are posting at additional sites, I would like to keep up with you. Could you list every one of your community pages like your twitter feed, Facebook page or linkedin profile?

My web blog home remodeling magazine

Post a Comment

Thanks for interest it