发布网友 发布时间:2023-06-05 14:21
共1个回答
热心网友 时间:2023-08-21 10:43
程序如下:STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENTDZ DB 0FFH,7FH,3FH,1FH,0FH,07H,03H,01H,00H,0FFH,00H,0FFHJT DB 55H,0AAHDATA ENDSCODE SEGMENT ASSUME CS:CODE, DS:DATASTART: MOV AX,DATA MOV DS,AX MOV AL,98H OUT 63H,AL ;初始化 L0: IN AL,62H ;检测k2,启动 TEST AL,40H JE L0 X: IN AL,62H TEST AL,80H ;检测k3 JNZ EXIT ;退出程序 IN AL,60H AND AL,0FH ;屏蔽高4位 CMP AL,00H ;AL的状态为00H JZ LOOP1 ;调用LOOP1子程序 CMP AL,01H ;AL的状态为01H JZ LOOP2 ;调用LOOP2子程序 CMP AL,02H ;AL的状态为02H JZ LOOP3 ;调用LOOP3子程序 CMP AL,03H ;AL的状态为03H JZ LOOP4 ;调用LOOP4子程序 JMP X LOOP1: MOV CX,08H MOV AL,0FEH ;左移子程序 ZY: OUT 61H,AL CALL DELAY ;调延时程序 ROL AL,1 LOOP ZY JMP X LOOP2: MOV CX,08H MOV AL,07FH ;右移子程序 YY: OUT 61H,AL CALL DELAY ;调延时程序 ROR AL,1 LOOP YY JMP X LOOP3: MOV BL,11 LEA SI,DZ DIZ: MOV AL,[SI] ;向右递增子程序 OUT 61H,AL CALL DELAY ;调延时程序 INC SI DEC BL JNZ DIZ JMP X LOOP4: MOV BL,2 LEA SI,JT JIAOT: MOV AL,[SI] ;交替亮灯子程序 OUT 61H,AL CALL DELAY ;调延时程序 INC SI DEC BL JNZ JIAOT JMP X EXIT: MOV AX,4C00H INT 21H DELAY: PUSH CX ;延时子程序 PUSH DX MOV CX, 0FFF0H ;延时LOOP5: MOV DX, 0FFF0HLOOP6: DEC DX JNZ LOOP6 POP DX POP CX RETCODE ENDS END START