微机原理8255并行接口实验-红绿灯的模拟实现

安徽大学2016年微机原理实验考试题:微机原理8255并行接口实验-红绿灯的模拟实现

SSTACK SEGMENT STACK
       DW 32 DUP(?)
SSTACK ENDS
CODE   SEGMENT
       ASSUME CS:CODE
START: MOV DX,0646H
       MOV AL,80H
       OUT DX,AL  
       MOV BX,03C0H
       CALL LIGHT
       CALL DDDELAY
       MOV BX,00C0H
       CALL LIGHT
       MOV BX,03C0H
       CALL LIGHT
       MOV BX,00C0H
       CALL LIGHT
       MOV BX,18C0H
       CALL LIGHT
       CALL DDDELAY
       MOV BX,0C003H
       CALL LIGHT
       CALL DDDELAY
       MOV BX,0C000H
       CALL LIGHT
       MOV BX,0C003H
       CALL LIGHT
       MOV BX,0C000H
       CALL LIGHT 
       MOV BX,0C018H
       CALL LIGHT
       CALL DDDELAY  
       JMP START
DELAY: PUSH CX
       MOV CX,0FFFFH
AA2:   PUSH AX
       POP  AX
       LOOP AA2
       POP  CX
       RET
DDDELAY:  CALL DELAY
          CALL DELAY
          CALL DELAY
          CALL DELAY
          CALL DELAY
          CALL DELAY
          CALL DELAY
          RET
LIGHT: MOV DX,0640H
       MOV AL,BH
       OUT DX,AL
       MOV DX,0642H
       MOV AL,BL
       OUT DX,AL
       CALL DDDELAY
       RET
       
CODE   ENDS
       END START


你可能感兴趣的:(微机原理实验课)