Re: Post ur C/C++ Programs Here
Character Eater:
This TSR program hooks itself with timer interrupt and selects a random row and coloums position at each run and writes space at that position, the person using the computer feels that something is eating up the characters from the screen.
Quote:
#include"dos.h"
#include<conio.h>
#include<stdlib.h>
//interrupt declarations
void interrupt (*prevtimer)();
void interrupt mytimer();
void writechar(char ch,int row,int col,int attr);
//a far pointer that will access video memory
char far* scr;
int a,b;
//our real program goes from here
void main()
{
scr=(char far*) 0xb8000000;
prevtimer=getvect( 8 );
setvect(8,mytimer);
keep(0,1000);
}
//timer function
void interrupt mytimer()
{
a=random(25);
b=random(80);
writechar(' ',a,b,0);
(*prevtimer)();
}
//function that writes picked up character
void writechar(char ch,int row,int col,int attr)
{
*(scr+row*160+col*2)=ch;
*(scr+row*160+col*2+1)=attr;
}
|
__________________
In my life, there are only two rules....
Rule No 1: I am always right...
Rule No 2: If i am wrong, please see rule no 1 again
|