资源描述:
《实验五 中断应用实验》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验五中断应用实验PCI中断实验编写一实验程序,使用实验装置提供的中断源,写成按键中断的响应。每产生一次按键中断,向显示器输出字符“7”INTCSR_BYTE0EQU9038HINTCSR_BYTE1EQU9039HINTCSR_BYTE2EQU903AHINTCSR_BYTE3EQU903BHIMB4_BYTE3EQU1FHDATASEGMENTCSBAKDW?IPBAKDW?MKBAKDB?DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:CLIMOVAX,DATAMOVDS,AXMOVDX,INTCSR_BYTE
2、0;初始化PCI板终端控制寄存器MOVAL,00HOUTDX,ALMOVDX,INTCSR_BYTE1MOVAL,1FHOUTDX,ALMOVDX,INTCSR_BYTE2MOVAL,3FHOUTDX,ALMOVDX,INTCSR_BYTE3MOVAL,00HOUTDX,ALMOVAX,0000H;保存和替换中断向量MOVES,AXMOVDI,01C4H;INT71H,01C4H=71H*4MOVAX,ES:[DI]MOVIPBAK,AX;保存IPMOVAX,OFFSETMYINT;放入新的中断处理程序的IPCLDSTOSWMOVAX,ES:[DI];保存CS
3、MOVCSBAK,AXMOVAX,SEGMYINT;放入新的中断处理程序的CSSTOSWINAL,0A1H;取从片中断屏蔽寄存器IMR的内容MOVMKBAK,ALANDAL,00FDH;0FCh--11111101hOUT0A1H,AL;允许从片8259第2号中断STIA1:NOPCALLBREAKJMPA1MYINT:PUSHDSPUSHAXPUSHDXMOVDX,IMB4_BYTE3;清PCI中断标志INAL,DXMOVDX,INTCSR_BYTE2MOVAL,3FHOUTDX,ALMOVAL,61H;01100001OUT0A0H,AL;结束从片IRQ9
4、对应的中断MOVAL,62H;01100010OUT20H,AL;结束主片IRQ2对应的中断MOVAH,0EH;显示字符‘7’MOVAL,37HINT10H;BIOS功能调用POPDXPOPAXPOPDSIRETBREAKPROCNEARPUSHDSMOVAH,06H;DOS功能调用MOVDL,0FFH;DL=0FFH表示单个字符输入INT21HJERETURN;若不退出,转RETURNPOPDS;以下为退出时的程序段CLIMOVAL,MKBAKOUT0A1H,ALMOVAX,0000H;恢复原中断向量MOVES,AXMOVDI,01C4H;INT71H,01
5、C4H=71H*4MOVAX,IPBAKCLDSTOSWMOVAX,CSBAKSTOSWSTIMOVAX,4C00H;返回DOSINT21HRETURN:POPDSRETBREAKENDPCODEENDSENDSTART