Industrial Training




Trapping Timer


A simple TSR to trap the timer interrupt

/*TimeTsr.c*/
#include<dos.h>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>

void interrupt our(...) ;
void interrupt (*prev)(...) ;

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


int ticks;
int i=67;
int j=0;

char str[]="avinash khare ";

void main( )
{

prev=getvect(8);/*get the timer ISR address*/
setvect(8,our);/*set our function address*/
keep(0,500);

}

void interrupt our(...)
{

ticks++;
if(ticks==18)
{

*(scr+5*2)=str[j];
*(scr+72*2)=str[j];
*(scr+24*80*2+5*2)=str[j];
*(scr+24*80*2+72*2)=str[j++];

if(j==13)

j=0;

ticks=1;

}

(*prev)( ) ; /*call the actual ISR*/

}

This is a simple program which displays my name starting from 'a' to 'e' and then again starting from 'a' at the top of screen at fifth position.

To run this program at the dos prompt type TimerTsr.exe and see the output at top of the screen.
now start the edit or TC you will see the effect there also.



Hi I am Pluto.