本文介绍了如何通过ctrl + alt + l键的组合生成中断。?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 C中编写一个TSR程序,它将清除屏幕上的所有内容并打印您的VU ID和名称(BC0000000-名称)在视频文本存储器的中心位于0xB8000000,只要Alt + Ctrl + D组合 按从键盘。
请注意,在清除屏幕之前,您必须备份视频文本内存的内容。并且,只要Alt + Ctrl + R组合从按 键盘,视频文本内存的所有内容应该恢复。
此问题的代码:
问题出现在代码的末尾键盘中断
// CLRSCREEN和角色打印程序
#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 远*)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(){
// 保存内容
for (i = 0 ; i < 4000 ; i ++)
charsrc [i] = *(SRC + I);
// 清算屏幕
for (i = 0 ; i < 4000 ; i + = 2 )
{
*(src + i)= 0x20;
*(src + i + 1 )= 0x07;
}
}
// 在图形文本内存中心打印RollNo和Name
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 );
// 功能
_AH = 0x09;
if (_ AL == 0x1D&& _AL == 0x38&& _AL == 0x20)
{
geninterrupt(0x65)中;
charPrint();
}
其他 如果(_ AL == 0x1D&& _AL = = 0x38&& _AL == 0x13)
{
restore();
}
}
}
我尝试了什么:
我多次尝试将键盘按键的扫描码放在啊但是失败了请纠正我的代码。
解决方案
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.
My Code for this Problem:
Problem occurs at the end of the code for keyboard interrupt
//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(); } } }
What I have tried:
I tried many times to put the scan code of Keyboard buttons in Ah but failed please correct me the code.
解决方案
这篇关于如何通过ctrl + alt + l键的组合生成中断。?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!