|
高手来。关于课程设计的程序有问题。本人实在无能为力。。求助!!!
[复制链接]
以下为电子台历的程序。。各位帮忙。。
主程序
LP1:
MOV AH,1 ;从键盘输入单个字符
INT 21H
CMP AL,'M' ;AL='M'?
JNE LP5
CALL DATE ;显示系统日期
LP2: MOV AH,1 ;从键盘输入单个字符
INT 21H
CMP AL,'M' ;AL='M'?
JNE LP5
CALL TIME ;显示系统时间
LP3: MOV AH,1 ;从键盘输入单个字符
INT 21H
CMP AL,'M' ;AL='M'?
JNE LP4
CALL STOPWATCH ;显示秒表
LP4: MOV AH,1 ;从键盘输入单个字符
INT 21H
CMP AL,'M' ;AL='M'?
JNE LP5
CALL RING
LP5: CMP AL,'Q' ;AL='Q'?
JNE LP1
MOV AH,4CH ;返回DOS状态
INT 21H
;---------------------------------------------------------------
;显示日期子程序
DATE PROC NEAR
DISPLAY:
MOV AH,2AH ;取日期CX:DH:DL=年:月:日 AL=星期
INT 21H
MOV SI,0
MOV AX,CX
MOV BX,100
DIV BL
MOV BL,AH
CALL BCDASC1 ;日期数值转换成相应的ASCII码字符
MOV AL,BL
CALL BCDASC1
INC SI
MOV AL,DH
CALL BCDASC1
INC SI
MOV AL,DL
CALL BCDASC1
MOV BP,OFFSET DBUFFER1
MOV DX,0C0DH
MOV CX,20
MOV BX,004EH
MOV AX,1301H
INT 10H
MOV AH,02H ;设置光标位置
MOV DX,0300H
MOV BH,0
INT 10H
MOV BX,0018H
REPEA:MOV CX,0FFFFH ;延时
REPEAT:LOOP REPEAT
DEC BX
JNZ REPEA
MOV AH,01H ;读键盘缓冲区字符到AL寄存器
INT 16H
JE DISPLAY
JMP LP2
MOV AX,4C00H
INT 21H
RET
DATE ENDP
;------------------------------------------------------
;显示时间子程序
TIME PROC NEAR
DISPLAY1:
MOV SI,0
MOV BX,100
DIV BL
MOV AH,2CH ;取时间CH:CL=时:分 DH:DL=秒:1/100秒
INT 21H
MOV AL,CH
CALL BCDASC ;将时间数值转换成ASCII码字符
INC SI
MOV AL,CL
CALL BCDASC
INC SI
MOV AL,DH
CALL BCDASC
MOV BP,OFFSET DBUFFER
MOV DX,0C0DH
MOV CX,20
MOV BX,004EH
MOV AX,1301H
INT 10H
MOV AH,02H
MOV DX,0300H
MOV BH,0
INT 10H
MOV BX,0018H
RE: MOV CX,0FFFFH
REA: LOOP REA
DEC BX
JNZ RE
MOV AH,01H
INT 16H
JE DISPLAY1
JMP LP3
MOV AX,4C00H
INT 21H
RET
TIME ENDP
;------------------------------------------------------
;显示秒表子程序
STOPWATCH PROC NEAR
DISPLAY2:
PUSHA
MOV SI,0
MOV BX,100
DIV BL
;CALL WATCH
DISP3:
MOV AX,DATA
MOV DS,AX
MOV AL,WHOUR
CALL BCDASC2 ;将时间数值转换成ASCII码字符
INC SI
MOV AL,WMIN
CALL BCDASC2
INC SI
MOV AL,WSEC
CALL BCDASC2
MOV AL,WMSEC
INC SI
CALL BCDASC2
MOV BP,OFFSET DBUFFER2
MOV DX,0C0DH
MOV CX,20
MOV BX,004EH
MOV AX,1301H
INT 10H
MOV AH,02H
MOV DX,0300H
MOV BH,0
INT 10H
MOV BX,0018H
RE2: MOV CX,0FFFFH
REA2: LOOP REA2
DEC BX
JNZ RE2
MOV AH,01H
INT 16H
JE DISPLAY2
POPA
JMP LP4
MOV AX,4C00H
INT 21H
RET
STOPWATCH ENDP
|
|