Write a TSR program in C that will clear all the contents of the screen and print your VU ID and Name (BC0000000-Name) at the center of the video text memory available at 0xB8000000 whenever Alt+Ctrl+D combination is pressed from keyboard. Note that you have to take the backup of the contents of video text memory before clearing the screen. And, whenever Alt+Ctrl+R combination is pressed from the keyboard, all the contents of video text memory should be restored.
//CLRSCREEN AND Character Printing Program #include<DOS.H> #include<stdio.h> void interrupt (*old)(); void interrupt scrnsvr(); //void interrupt (*oldkey)(); //void interrupt newkey(); //void cls(); SALMAN HAIDER unsigned char far *scr = (unsigned char far*)0xb8000680; unsigned char far *src = (unsigned char far*)0xb8000000; unsigned char far *sch = (unsigned char far*)0x00400017; int i,j; char charsrc[4000]; void interrupt scrnsvr(){ //saving contents for(i=0; i < 4000; i++) charsrc[i] = *(src+i); //Clearing Screen for(i=0; i < 4000; i+=2) { *(src + i) = 0x20; *(src + i + 1) = 0x07; } } //Prints RollNo and Name at Center of Graphics Text Memory void charPrint(){ *scr = 0x6D; *(scr+1) = 0x70; *(scr+2) = 0x63; *(scr+3) = 0x07; *(scr+4) = 0x31; *(scr+5) = 0x07; *(scr+6) = 0x34; *(scr+7) = 0x07; *(scr+8) = 0x30; *(scr+9) = 0x07; *(scr+10) = 0x34; *(scr+11) = 0x07; *(scr+12) = 0x30; *(scr+13) = 0x07; *(scr+14) = 0x32; *(scr+15) = 0x07; *(scr+16) = 0x32; *(scr+17) = 0x07; *(scr+18) = 0x39; *(scr+19) = 0x07; *(scr+20) = 0x37; *(scr+159) = 0x07; *(scr+160) = 0x53; *(scr+161) = 0x07; *(scr+162) = 0x61; *(scr+163) = 0x07; *(scr+164) = 0x6C; *(scr+165) = 0x07; *(scr+166) = 0x6D; *(scr+167) = 0x07; *(scr+168) = 0x61; *(scr+169) = 0x07; *(scr+170) = 0x6E; *(scr+171) = 0x07; *(scr+172) = 0x20; *(scr+173) = 0x07; *(scr+174) = 0x48; *(scr+175) = 0x07; *(scr+176) = 0x61; *(scr+177) = 0x07; *(scr+178) = 0x69; *(scr+179) = 0x07; *(scr+180) = 0x64; *(scr+181) = 0x07; *(scr+182) = 0x65; *(scr+183) = 0x07; *(scr+184) = 0x72; } void restore(){ for(j=0; j < 4000; j++) *(src + j) = charsrc[j]; } /* void interrupt newkey(){ *sch = 24; *(sch+1) = 34; geninterrupt(0x65); charPrint(); (*oldkey)(); */ void main(){ //Cls // oldkey = getvect(0x09); // setvect(0x09, newkey); old = getvect(0x65); setvect(0x65,scrnsvr); keep(0,1000); //Function _AH = 0x09; if(_AL==0x1D && _AL==0x38 && _AL==0x20) { geninterrupt(0x65); charPrint(); } else if(_AL==0x1D && _AL==0x38 && _AL==0x13) { restore(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)