W BIT P3.6
R BIT P3.7
CE BIT P1.7
DATA1 EQU 43H第一参桥培稿敏孝数
DATA2 EQU 44H第二参数
COMEQU 45H命令寄存器
*******************************************
ORG 0000H
jmp MAIN
ORG 0100H
***************************************
MAIN:
液晶初始化中巧
MOV COM,#80H SET or 模式命令
LCALL WRITEDATA3
NOP
MOV DATA1,#00H SET TEXT HOME AREA ADDRESS 1000H
MOV DATA2,#10H
MOV COM,#40H
LCALL WRITEDATA
NOP
MOV DATA1,#1EH SET TEXT AREA ADDRESS 001EH
MOV DATA2,#00H
MOV COM,#41H
LCALL WRITEDATA
NOP
MOV DATA1,#00H SET GRAPHIC HOME AREA ADDRESS 2000H
MOV DATA2,#20H
MOV COM,#42H
LCALL WRITEDATA
NOP
MOVDATA1,#1EH SET GRAPHIC AREA ADDRESS 001EH
MOV DATA2,00H
MOV COM,#43H
LCALL WRITEDATA
NOP
MOV DATA1,#0FH SET OFFSET REGISTER 000FH
MOV DATA2,#00H
MOV COM,#22H
LCALL WRITEDATA
NOP
MOV DATA1,#00H SET ADDRESS POINTER 7C00H
MOV DATA2,#7CH
MOV COM,#24H
LCALL WRITEDATA
NOP
MOV COM,#9CH SET TEXT ON,GRAPHIC ON
LCALL WRITEDATA3
NOP
**************************************************************
STACK SEGMENT STACKDW 200 DUP (?)
STACK ENDS
DATA SEGMENT
WHOUR DB 0 秒表的时、分、秒、毫秒
WMIN DB 0
WSEC DB 0
WMSEC DB 0
OLD1CHDD 0
SIGNAL DB 0
COUNT DW 0
---------------------------------------------------------------------------------------------------------------
CHOUR DB 0 闹钟的时、分、弊运秒
CMIN DB 0
CSEC DB 0
-----------------------------------------------------------------------------------------------------------------
SPACE DB 2000 DUP (' ')
PATTERN DB 6 DUP (' '),0C9H,26 DUP (0CDH),0BBH,6 DUP (' ')
DB 6 DUP (' '),0BAH,26 DUP (20H),0BAH,6 DUP (' ')
DB 6 DUP (' '),0C8H,26 DUP (0CDH),0BCH,6 DUP (' ')
----------------------------------------------------------------------------------------------------------------
DBUFFER DB 8 DUP (':'),12 DUP (' ')
DBUFFER1 DB 20 DUP (' ')
DBUFFER2 DB 11 DUP (':'),15 DUP (' ')
STR DB 0DH,0AH, '租段梁 INPUT ''M'' TO NEXT-STATE, INPUT ''Q'' TO EXIT: $',0DH,0AH,'$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK
-------------------------------------------------------------------
PUSHA MACRO
PUSH DS
PUSH AX
PUSH BX
PUSH CX
PUSH DX
ENDM
POPA MACRO
POP DX
POP CX
POP BX
POP AX
POP DS
ENDM
图形化界面设计
START:
MOV AX,DATA
MOV DS,AX
MOV ES,AX
MOV AX,0003H 设置显示方式为40*25彩燃谨色文本方式
INT 10H
LEA DX,STR显示提示信息
MOV AH,9
INT 21H
MOV BP,OFFSET SPACE
MOV DX,0B00H
MOV CX,1000
MOV BX,0000H
MOV AX,1300H
INT 10H 显示字符串,定义显示方式
---------------------------------------------------------------
主程序
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
TIMEENDP
------------------------------------------------------
显示秒表子程序
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
STOPWATCHENDP
----------------------------------------------------------------
显示闹钟子程序
RING PROC NEAR
DISPLAY3:
PUSHA
MOV SI,0
MOV BX,100
DIV BL
MOV AH,CH 取时间CH:CL=时:分 DH:DL=秒:1/100秒
INT 21H
MOV AX,DATA
MOV DS,AX
MOV AL,CHOUR
CALL BCDASC 将时间数值转换成ASCII码字符
INC SI
MOV AL,CMIN
CALL BCDASC
INC SI
MOV AL,CSEC
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
RE3: MOV CX,0FFFFH
REA3:LOOP REA3
DEC BX
JNZ RE3
MOV AH,01H
INT 16H
JE DISPLAY3
POPA
JMP START
MOV AX,4C00H
INT 21H
RET
RINGENDP
----------------------------------------------------------------
时间数值转换成ASCII码字符子程序
BCDASC PROC NEAR
PUSH BX
CBW
MOV BL,10
DIV BL
ADD AL,'0'
MOV DBUFFER[SI],AL
INC SI
ADD AH,'0'
MOV DBUFFER[SI],AH
INC SI
POP BX
RET
BCDASC ENDP
-----------------------------------------------------------------
日期数值转换成ASCII码字符子程序
BCDASC1 PROC NEAR
PUSH BX
CBW
MOV BL,10
DIV BL
ADD AL,'0'
MOV DBUFFER1[SI],AL
INC SI
ADD AH,'0'
MOV DBUFFER1[SI],AH
INC SI
POP BX
RET
BCDASC1 ENDP
------------------------------------------------------------------
秒表时间数值转换成ASCII码字符子程序
BCDASC2 PROC NEAR
PUSH BX
CBW
MOV BL,10
DIV BL
ADD AL,'0'
MOV DBUFFER2[SI],AL
INC SI
ADD AH,'0'
MOV DBUFFER2[SI],AH
INC SI
POP BX
RET
BCDASC2 ENDP
---------------------------------------------------------------------
CODE ENDS
END START
这是主要的程序,完全可以用.其它的子程序比较多,我再发给你好了.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)