资源描述:
《读取键盘缓冲区状态》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、;***读取键盘缓冲区状态***SCANKEYMACROPUSHAXMOVAH,01HINT16HPOPAXENDM;***读取键盘值INPKEYMACROMOVAH,00HINT16HMOVBL,ALPOPAXENDM;***显示程序宏***DISMACROPUSHDXPUSHDXPUSHCXMOVAX,0600HMOVCX,0000HMOVDX,01927HINT10HPOPCXPOPDXLEASI,ZM2012CALLDRAWCALLDLYPOPDXENDMSTACKSEGMENTDW100DUP(?)STACKENDSCODESEGMENTASSUMECS:CODESTRIN
2、G:DB'Pressanykeytostart,Pressq/Qtoquitpressp/Ptopause!$'ZM2012:DB0F7H,0AFH,14H,0A1H,14H,0A1H,0F4H,0AFHDB84H,0A8H,84H,0A8H,0F7H,0AFH,00H,00HSTART:PUSHCSPOPDSMOVDX,0909HMOVAH,02HINT10HLEADX,STRINGMOVAH,9INT21HINPKEYCMPBL,71HJEQUITMOVAX,13HINT10H;AL=1332×200256色图形(EGA)CLD;清方向标志使DF=0;按增量的方式修改串指针MOV
3、DI,BXMOVBH,0MOVBL,05HMOVAH,0BH;背景色INT10HMOVBX,DIMOVDX,0501H;确定屏幕显示起始坐标JMPL1L21:CMPDL,24JEL3L1:DISINCDLINCDHCMPDH,18JEL12CMPDL,24JEL3LOOPL1;1行增列增行最大值->2列最大值->3行列同时达最大值->4L12:CMPDL,24JEL4L2:DISDECDHINCDLCMPDH,0JEL21CMPDL,24JEL4LOOPL2;2行减列增行最小值->1列最大值->4行达最小值时列达最大值->3L43:CMPDL,0JEL1L3:DISINCDHDECD
4、LCMPDH,18JEL34CMPDL,0JEL1LOOPL3;3行增列减行最大值->4列最小值->1行达最大值时列达最小值->2L34:CMPDL,0JEL2L4:DISDECDHDECDLCMPDH,0JEL43CMPDL,0JEL2LOOPL4;4行减列减行最小值->3列最小值->2行列同时达最小值->1;退出QUIT:MOVAH,4CHINT21H;返回DOS;暂停PAUSE:SCANKEYJEPAUSEINPKEYCMPBL,70HJEDL3CMPBL,50HJEDL3CMPBL,71HJEQUITCMPBL,51HJEQUITJMPPAUSEDRAW:MOVBP,8T1:
5、PUSHDXLODSB;把SI寻址的源串的数据;字节送AL,并SI++CALLSHOWLODSBCALLSHOWPOPDXINCDH;行+1DECBPJNZT1RET;***显示子程序***SHOWPROCNEARMOVCX,8;显示8列MOVBL,ALS1:MOVAH,2INT10H;设定光标SHLBL,1JNBS2;CF为0的时候跳转S2PUSHDXADDDL,070HMOVAL,DL;字的颜色POPDXJMPS3S2:MOVAL,00HS3:PUSHBXPUSHCXMOVBL,AL;字符颜色MOVAL,1H;显示太阳MOVCX,1;次数MOVAH,9;功能号INT10H;写字符
6、到当前光标处POPCXPOPBXINCDL;列+1LOOPS1RETSHOWENDP;***延时子程序***DLYPROCNEARPUSHCXPUSHDXMOVDX,10000;外循环次数初值DL1:MOVCX,7000;内循环次数初值DL2:LOOPDL2DECDX;CX为0时DX-1JNZDL1;DX不为零时跳转至DL1POPDXPOPCX;***将键盘扫描增加至延时函数***SCANKEYJEDL3INPKEYCMPBL,71HJEQUITCMPBL,51HJEQUIT;按q或Q键跳转至退出CMPBL,70HJEPAUSECMPBL,50HJEPAUSE;按P或p跳转至暂停DL
7、3:RETDLYENDP;********ENDSTARTCODEENDS