.
六、程序流程图
等于59 等于100 不等 开 始 0.01S计数 1S计数 1M计数 等于59 不等 不等
'.
1H计数
BCD码调整指令10进制显示 BVD 处 理 产 生 溢 出 清 空 .
七、程序代码
DATAS SEGMENT
DW 100 DUP(?)
ZXM DB 3fH,06H,5bH,4fH,66H,6dH,7dH,07H,7fH,6fH HOU1 DB 0 HOU2 DB 0 MIN1 DB 0 MIN2 DB 0 SEC1 DB 0 SEC2 DB 0
; buf BYTE 0,1,2,3,4,5,6,7,8,9;显示缓冲区 ; FLAG BYTE 0 ; STATE BYTE 0
; KEYMARK BYTE 0;此处输入数据段代码 DATAS ENDS
STACKS SEGMENT DW 100 DUP(?) STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
;;;;;;;;;;;;;;;;;;中断初始化 PUSH DS PUSH BX
MOV AX,0000H MOV DS,AX MOV BX,0008H
MOV DX,OFFSET TIAOSHI MOV [BX],DX MOV BX,000AH
MOV DX,SEG TIAOSHI MOV [BX],DX POP BX POP DS
MOV AX,DATAS MOV DS,AX MOV AX,DATAS MOV SS,AX
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
'.
.
MOV AL,89H ;8255 A口和B口输出,C口输入 MOV DX,206H OUT DX,AL
MOV AL,3FH MOV DX,202H OUT DX,AL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV AL,00110110B ;初始化8253,CNT0; MOV DX,0406H OUT DX,AL MOV AX,500 MOV DX,0400H OUT DX,AL MOV AL,AH OUT DX,AL
MOV AL,01010000B MOV DX,0406H OUT DX,AL MOV DX,0402H MOV AL,20 OUT DX,AL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SHUCHU:
LEA SI,ZXM MOV BX,0000H
MOV AL,11111110B MOV DX,200H OUT DX,AL
MOV BL,SEC2 MOV AL,[SI+BX] MOV DX,202H OUT DX,AL MOV CX,200H S1: LOOP S1
MOV AL,11111101B MOV DX,200H OUT DX,AL MOV BL,SEC1 MOV AL,[SI+BX] MOV DX,202H OUT DX,AL
'.
; CNT1 ; .
'.
MOV CX,200H S2: LOOP S2
MOV AL,11111011B MOV DX,200H OUT DX,AL MOV BL,MIN2 MOV AL,[SI+BX] MOV DX,202H OUT DX,AL MOV CX,200H S3: LOOP S3
MOV AL,11110111B MOV DX,200H OUT DX,AL MOV BL,MIN1 MOV AL,[SI+BX] MOV DX,202H OUT DX,AL MOV CX,200H S4: LOOP S4
MOV AL,11101111B MOV DX,200H OUT DX,AL MOV BL,HOU2 MOV AL,[SI+BX] MOV DX,202H OUT DX,AL MOV CX,200H S5: LOOP S5
MOV AL,11011111B MOV DX,200H OUT DX,AL MOV BL,HOU1 MOV AL,[SI+BX] MOV DX,202H OUT DX,AL MOV CX,200H S6: LOOP S6 JMP SHUCHU
.
PANDUAN: INC SEC2
CMP SEC2,0AH JNZ SHUCHU
MOV SEC2,0 INC SEC1
CMP SEC1,0AH JNZ SHUCHU
MOV SEC1,0 INC MIN2
CMP MIN2,0AH JNZ SHUCHU
MOV MIN2,0 INC MIN1
CMP MIN1,06H JNZ SHUCHU
MOV MIN1,0 INC HOU2
CMP HOU2,0AH JNZ SHUCHU
MOV HOU2,0 INC HOU1
CMP HOU1,06H JNZ SHUCHU
MOV HOU1,0
JMP SHUCHU
TIAOSHI PROC
;;;;;;;;;;;;中断子程序
MOV AL,01010000B MOV DX,0406H OUT DX,AL MOV DX,0402H MOV AL,20
OUT DX,AL JMP PANDUAN ;;;;;;;;;;;;;;;;;;;;;;; RET TIAOSHI ENDP
'.
初始化CNT1 ; ;