大榕树——让我们共成长!
大榕树 myDrs.org
您的位置:大榕树 \ 编程       |  Logo语言   |  Pascal语言   |  信息学奥赛   |  高考保送    |  HTML版本
|  Pascal语言>>Pascal练习>>简单的按键检测子程序         本站全文搜索: 友情提示:

简单的按键检测子程序
http://www.mydrs.org  9/2/2001  大榕树


program KeyTest;

{$A+,B-,E-,F-,G+,N+,O-,P+,T-,V-,X+}
{$D-,I-,L-,Q-,R-,S-,Y-}
{$M 65520,0,655360}

uses
 Dos;

var
 SaveKeyInterrupt:procedure;
 Key:Byte;

procedure KeyInterrupt;interrupt;
begin
 Key:=Port[96];
 inline($9C);{PUSHF----标志寄存器压栈}
 SaveKeyInterrupt;
end;

begin
 Key:=0;
 GetIntVec(9,@SaveKeyInterrupt);
 SetIntVec(9,@KeyInterrupt);
 WriteLn('Press ESC to exit');
 repeat
  if Key=1 then Break;
  if (Key>0)and(Key<128) then
  begin
   WriteLn('You pressed a key of ',Key);
   Key:=0;
  end;
  if Key>=128 then
  begin
   WriteLn('You unpressed a key of ',Key);
   Key:=0;
  end;
 until False;
 SetIntVec(9,@SaveKeyInterrupt);
end.


作 者:陈世熹
来 源:陈世熹的Pascal
共有3655位读者阅读过此文

  • 上篇文章简单的时钟控制子程序
  • 下篇文章NOI2001在西北大学举行

  • 发送邮件
    保存页面 打印文章 HTML版本 发表评论

    □- 近期热门文章 □- 相关文章
    1. NOIP2006竞赛大纲 [8307]
    2. 七类高中生具有保送资格 [5911]
    3. NOI2006获奖选手名单 [4956]
    4. 关于举办NOIP2006模拟赛的通告 [4107]
    5. Turbo Pascal各语句运行速... [3595]
    6. Turbo王者归来新Delphi免费... [3182]
    7. IOI2006我国4名选手全部获得金... [2946]
    8. 关于APIO2007与IOI2007... [2764]
    9. noip倒计时 by 枯叶蝴蝶 [2684]
    10. 朱泽园:思想上的金牌更重要 [2169]
    简单的按键检测子程序
    简单的时钟控制子程序
    简单的Ctrl-Break控制子程序
    设置中断子程序
    调用中断
    中断向量表
     

    关于本站 | 合作伙伴 | 联系方式
    大榕树 版权所有 ©1999-2006 www.myDrs.org 闽ICP备05000721号