| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1009 人关注过本帖
标题:电子时钟
只看楼主 加入收藏
hl3289
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-12-19
收藏
 问题点数:0 回复次数:2 
电子时钟

下面这个时钟不知道哪错拉!!还有谁有数字电子钟程序啊?发上来看下!!看能不能显示出来!!




DATA SEGMENT
DISPLAY DB ?
MSG DB "PRESS 'ESC' TO EXIT...",10H,13H
BKCOLOR DW 6D6DH
MCOLOR DW 0030H
SCOLOR DW 0028H
MEM DW ?
NUBTBL DB 1, 1, 1, 0, 1, 1, 1 ; 0
DB 0, 0, 1, 0, 0, 1, 0 ; 1
DB 1, 0, 1, 1, 1, 0, 1 ; 2
DB 1, 0, 1, 1, 0, 1, 1 ; 3
DB 0, 1, 1, 1, 0, 1, 0 ; 4
DB 1, 1, 0, 1, 0, 1, 1 ; 5
DB 1, 1, 0, 1, 1, 1, 1 ; 6
DB 1, 0, 1, 0, 0, 1, 0 ; 7
DB 1, 1, 1, 1, 1, 1, 1 ; 8
DB 1, 1, 1, 1, 0, 1, 1 ; 9
PTSEG DW 7,2,35,10
DW 2,7,10,35
DW 32,7,40,35
DW 7,32,35,40
DW 2,37,10,65
DW 32,37,40,65
DW 7,62,35,70

DATA ENDS

CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AX,0A000H
MOV ES,AX

MOV AH,0FH
INT 10H
MOV DISPLAY,AL ;save display

MOV AX,0013H
INT 10H ;set display

CLD
MOV AX,BKCOLOR
XOR DI,DI
MOV CX,08000H
REP STOSW
_WAIT:
MOV AH,2CH
INT 21H ;read time

PUSH CX
PUSH DX
CALL MYTIME

MOV AH,1
INT 16H ;read buffer of keyboard

PUSH AX
MOV DL,0FFH
MOV AX,0C06H ;clear keyboard buffer
INT 21H

POP AX
SUB AL,1BH
JNZ _WAIT

MOV AL,DISPLAY
MOV AH,00
INT 10H ;resume the model of displing

MOV AX,4C00H
INT 21H ;return to dos

;************* End Of Main() *************************

;------------ my three process ---------------------
proc 0:
MYTIME PROC NEAR PASCAL USES AX BX CX DX DI SI,
hm:word,sec:word
MOV CX,HM ;hour
XOR AX,AX
MOV AL,CH
AAM
PUSH AX
MOV CL,8
SHR AX,CL
MOV DX,20
PUSH DX
MOV DX,50
PUSH DX
PUSH MCOLOR
PUSH AX
CALL DISPLAYDIGIT

POP AX
AND AX,0FH
MOV DX,62
PUSH DX
MOV DX,50
PUSH DX
PUSH MCOLOR
PUSH AX
CALL DISPLAYDIGIT
MOV CX,HM ;mintute
XOR AX,AX
MOV AL,CL
AAM
PUSH AX
MOV CL,8
SHR AX,CL
MOV DX,116
PUSH DX
MOV DX,50
PUSH DX
PUSH MCOLOR
PUSH AX
CALL DISPLAYDIGIT

POP AX
AND AX,0FH
MOV DX,158
PUSH DX
MOV DX,50
PUSH DX
PUSH MCOLOR
PUSH AX
CALL DISPLAYDIGIT
MOV CX,SEC ;second
XOR AX,AX
MOV AL,CH
AAM
PUSH AX
MOV CL,8
SHR AX,CL
MOV DX,212
PUSH DX
MOV DX,50
PUSH DX
PUSH SCOLOR
PUSH AX
CALL DISPLAYDIGIT

POP AX
AND AX,0FH
MOV DX,254
PUSH DX
MOV DX,50
PUSH DX
PUSH SCOLOR
PUSH AX
CALL DISPLAYDIGIT

RET
MYTIME ENDP

proc 1:
DISPLAYDIGIT PROC NEAR PASCAL USES AX BX CX DX DI SI,
x:word,y:word,color:word,num:word
LEA SI,NUBTBL
MOV BX,7
MOV AX,NUM
MUL BX
ADD SI,AX ;choise a number
LEA DI,PTSEG
XOR CX,CX
_FOR:
MOV BX,BKCOLOR
CMP BYTE PTR DS:[SI],0
JE DISPL
MOV BX,COLOR
DISPL:
MOV DX,X
ADD DX,DS:[DI]
PUSH DX

MOV DX,Y
ADD DX,DS:[DI+2]
PUSH DX

MOV DX,X
ADD DX,DS:[DI+4]
PUSH DX

MOV DX,Y
ADD DX,DS:[DI+6]
PUSH DX
PUSH BX
CALL DRAWSIXGON

INC SI
ADD DI,8
INC CX
CMP CX,7
JNE _FOR

RET
DISPLAYDIGIT ENDP

proc 2:
DRAWSIXGON PROC NEAR PASCAL USES AX BX CX DX DI SI,
startX:word,startY:word,endX:word,endY:word,color:word
LOCAL FLAG:WORD

MOV FLAG,1
MOV BX,STARTX
MOV SI,STARTY
MOV AX,320
MUL SI
ADD AX,BX
MOV MEM,AX ;mem=320*startY+startX
MOV AX,ENDY
SUB AX,STARTY
MOV DX,ENDX
SUB DX,STARTX
MOV CX,DX

CMP AX,DX
JC DRAW
MOV FLAG,320 ;direct
MOV CX,AX
DRAW:
XOR BX,BX
XOR SI,SI
MOV DX,3
MOV BX,COLOR
SUB CX,8 ;length of line - 8
PUSH CX
ABOVE:
MOV DI,SI ;retive point of starting
PUSH DX
MOV AX,FLAG
MUL DX
POP DX
ADD SI,AX
ADD SI,MEM
@@1:
MOV BYTE PTR ES:[SI],BL
ADD SI,FLAG ;next pix
DEC CX ;bx-->next line
JNZ @@1
POP CX
ADD CX,2
PUSH CX
CMP FLAG,1
JNE @@2
ADD DI,320
JMP $+3
@@2:
INC DI
MOV SI,DI ;next line
DEC DX
JNZ ABOVE
DOWN:
MOV DI,SI ;retive point of starting
PUSH DX
MOV AX,FLAG
MUL DX
POP DX
ADD SI,AX
ADD SI,MEM
@@3:
MOV BYTE PTR ES:[SI],BL
ADD SI,FLAG
DEC CX
JNZ @@3
POP CX
SUB CX,2
PUSH CX
CMP FLAG,1
JNE @@4
ADD DI,320
JMP $+3
@@4:
INC DI
MOV SI,DI
INC DX
CMP DX,4
JNZ DOWN

POP CX
RET

DRAWSIXGON ENDP

CODE ENDS
END START

搜索更多相关主题的帖子: 时钟 电子 
2005-12-21 12:27
yk87458410
Rank: 1
等 级:新手上路
帖 子:65
专家分:0
注 册:2005-9-26
收藏
得分:0 
我在51单片机上可以用的程序,不过是用C写的你要不要啊。

2005-12-21 22:37
hl3289
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-12-19
收藏
得分:0 
也好啊 ,研究一下 !!
2005-12-22 12:44
快速回复:电子时钟
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035583 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved