1、实验48259中断实验,STACK SEGMENT STACKDW 64 DUP(?) STACK ENDSCODE SEGMENTASSUME CS:CODE,SS:STACKSTART:PUSH DS ;保存数据段MOV AX,0000HMOV DS,AX ;数据段清0MOV AX,OFFSET IRQ7 ;取中断程序入口地址(相对地址)ADD AX,2000H ;加装载时IP2000H地址(绝对地址)MOV SI,003CH ;填8259中断7中断向量MOV SI,AX ;填偏移地址MOV AX,0000H ;段地址CS0000HMOV SI,003EHMOV SI,AX ;填段地址向量
2、CLI ;关中段,POP DSIN AL,21H ;读8259中断屏蔽字AND AL,7FH ;开8259中断7OUT 21H,ALMOV CX,000AH A1: CMP CX,0000H JNZ A2IN AL,21HOR AL,80HOUT 21H,ALSTIHLT A2: STIJMP A1 ;断点,IRQ7: MOV AX,0137H ;中断程序入口地址INT 10H ;BIOS功能调用,MOV AX,0120H ;显示“7”和空格INT 10HDEC CXMOV AL,20HOUT 20H,ALCLIIRET CODE ENDSEND START,实验48259中断实验,注意:程序
3、中8259中断向量地址为绝对地址,已定义为段地址CS=0000H,偏移地址IP=2000H,故装载时一定按此填入CS与IP地址.后面实验不再重述). 分析程序 问题? 实验考试如果改变为IRQ3,或其它,程序应如何改动?,实验58255并行接口应用实验(1),STACK SEGMENT STACKDW 64 DUP(?) STACK ENDSCODE SEGMENTASSUME CS:CODE,SS: STACKSTART: MOV AL,83H ;10000011OUT 63H,AL A1: IN AL,61HOUT 60H,ALJMP A1 CODE ENDSEND START,实验582
4、55并行接口应用实验(2),STACK SEGMENT STACKDW 64 DUP(?) STACK ENDS CODE SEGMENTASSUME CS:CODE START: CLI ;关中断MOV AL,86H ;控制字10000110OUT 63H,ALMOV AL,05H ;控制字00000101pc2置位,kk1下降沿触发OUT 63H,AL MOV AX,0000HMOV DS,AXMOV AX,OFFSET IRQ7ADD AX,2000HMOV SI,003CHMOV SI,AX,MOV AX,0000HMOV SI,003EHMOV SI,AXIN AL,21HAND A
5、L,7FHOUT 21H,AL A1: STI ;开中断HLTJMP A1 IRQ7: IN AL,61HOUT 60H,ALMOV AL,20HOUT 20H,ALIRET CODE ENDSEND START,STACK SEGMENT STACKDW 256 DUP(?) STACK ENDS DATA SEGMENT TABLE DB 01H,03H,02H,06H,04H,0CH,08H,09H DATA ENDS CODE SEGMENTASSUME CS:CODE,DS:DATA START: MOV AX,DATAMOV DS,AX MAIN: MOV AL,90H OUT 6
6、3H,AL A1: MOV BX,OFFSET TABLEMOV CX,0008H A2: MOV AL,BX OUT 61H,ALCALL DALLY INC BX,LOOP A2JMP A1 DALLY: PUSH CX MOV CX,5000H A3: PUSH AXPOP AXLOOP A3POP CXRET CODE ENDSEND START,实验68253计数器应用实验,设定8253的2#通道工作方式为方式0,用于事件计数,当计数值为5时,发出中断请求信号,显示“M”。实验部分程序如下:,Stack segment stackdw 64 dup(?) Stack ends Cod
7、e segmentassume ss:code,ss:stack Start: in al,21hand al,7fhout 21h,alMOV AL,90HOUT 43H,AL A1: MOV AL,05HOUT 42H,AL,hltstijmp a1mov ax,014dhint 10hmov ax,0120hint 10hMov al,20hout 20h,aliret Code endsend start,实验68253计数器应用实验(2),实验68253计数器应用实验(2),实验68253计数器应用实验(2),STACK SEGMENT STACKDW 64 DUP(?) STACK
8、 ENDSCODE SEGMENTASSUME CS:CODESTART: PUSH DSMOV AX,0000HMOV DS,AXMOV AX,OFFSET IRQ0ADD AX,2000HMOV SI,0020HMOV SI,AXMOV AX,0000HMOV SI,0022HMOV SI,AXPOP DS,MOV AL,0FCHOUT 21H,ALMOV AL,15HOUT 43H,ALMOV AL,0FFHOUT 40H,ALMOV DL,30H A1: STIJMP A1 IRQ0: MOV AH,01HMOV AL,DLCMP AL,3AHJNZ A2MOV AL,0DHINT 10H,实验68253计数器应用实验(2),MOV AL,30H A2: INT 10HINC AXMOV DL,ALMOV AX,0120HINT 10HCALL DALLYMOV AL,20HOUT 20H,ALIRET DALLY: PUSH AXMOV CX,0100H,A3: MOV AX,0560H A4: DEC AXJNZ A4LOOP A3POP AXRET CODE ENDSEND START,