电子日历微机课程设计.doc_第1页
电子日历微机课程设计.doc_第2页
电子日历微机课程设计.doc_第3页
电子日历微机课程设计.doc_第4页
电子日历微机课程设计.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

stack segmentstackdw64 dup(?)stackends clearscreen macro ;清屏宏 push ax push bx push cx push dx mov ah,6 mov al,0 mov bh,7 ;blank line mov cx,0000h ;upper left row+upper left column (0,0) mov dx,184fh ;lower right row+lower right colum (24,79) int 10h pop dx pop cx pop bx pop ax endmshowlineMACROSTR,STA,LEN,POS,COL ;显示字符串宏PUSHDXPUSHBXPUSHAXMOVBP,OFFSET STRADDBP,STAMOVDX,POSMOVCX,LENMOVBX,COLMOVAX,1301HINT10HPOPAXPOPBXPOPDXendmdata segment ;数据定义 str1 db TIME str2 db DATE string db TIME DATE time db 00:00:00 date db 0000-00-00 year dw 0 mouth db 0 day db 0 hour db 0 minute db 0 second db 0 sbuf db 00 sbufy db 0000 flg1 db 0 flg2 db 0 flg3 db 0 dp db yeardataendscodesegmentassume cs:code, ds:datastart:;main proc far ;主函数 mov ax, data mov ds, ax MOV es, ax mov ah,01h mov cx,2000h int 10h call gettime ;调用系统时间 call getdate;调用系统日期function1: ;功能一 mov flg1,0 clearscreen showline string,0,9,0a20h,0001h ;功能一初始化显示 showline str1,0,4,0a20h,0029h showline time,0,8,0b20h,0004hcall showtimeallN11:call showtime call getchar cmp al, a jne M11 call settimeM11:cmp al, m jne M12 jmp function2M12: cmp al, q je goesc jmp N11 function2: ;功能二 mov flg1,3 clearscreen showline string,0,9,0a20h,0001h ;功能二初始化显示 showline str2,0,4,0a25h,0029h showline date,0,10,0b20h,0004h call showdateall N22:call getchar cmp al, a jne N2 call setdateN2: cmp al, q je goesc cmp al, m jne N22 cmp al,m je function1 goesc:mov ah, 4ch ;退出 int 21h getchar proc near ;得到字符 mov ah,07h int 21h retgetchar endpgettime proc near ;得系统时间 mov ah,2ch int 21h mov hour,ch mov minute,cl mov second,dh retgettime endpgetdate proc near ;得系统日期 mov ah,2ah int 21h mov year,cx mov mouth,dh mov day,dl retgetdate endp bcdch proc near ;db=00未储存 mov bl,0ah mov ah,00h div bl add al,30h add ah,30h retbcdch endp seconddelay proc near ;延时一秒 pushaxpushbxpushdxmov ah,00Hint 1aHadd dl,17mov bl,dllop1: mov ah, 00Hint1ahcmpdl,bljnzlop1pop dxpop bxpop axretseconddelay endp waitf proc near ;61h 端口的延时子程序10ms push ax mov cx,6630waitf1: in al,61h and al,10h cmp al,ah je waitf1 mov ah,al loop waitf1 pop ax retwaitf endpshowtimeproc ;时钟程序loop1: mov ah,01h int 16h jnz loop2 ti1: call seconddelay ;延时一秒 inc second mov al,second call showbuf showline sbuf,0,2,0b26H,0004H ;秒加 cmp second,58 jna loop1 mov second,-1 inc minute mov al,minute call showbuf showline sbuf,0,2,0b23H,0004H ;分加 cmp minute,58 jna loop1 mov minute,-1 inc hour mov al,hour call showbuf showline sbuf,0,2,0b20H,0004H ;小时加 cmp hour,23 jna loop1 mov hour,0 inc day ;日加 cmp day,30 jna loop1 mov day,1 inc mouth ;月加 cmp mouth,11 jna loop1 mov mouth,1 inc year ;年加 jmp loop1 loop2:retshowtimeendp settime proc near ;设置时间 flg1=0,1,2 分别代表调整时分秒 call movshuR1: call getchar cmp al,i jne K11 call addshu call showtimeall call movshu jmp R1 K11: cmp al,a jne k12 inc flg1 cmp flg1,3 jne p1 mov flg1,0 p1: call showtimeall call movshu jmp R1k12: cmp al,q jne k13 jmp goesc k13: cmp al,m je function1 jmp R1 ret settime endp setdate proc near ;设置日期 flg1=3,4,5 分别代表调整年月日 call movshuR2: call getchar cmp al,i jne K21 call addshu call showdateall call movshu jmp R2 K21: cmp al,a jne k22 inc flg1 cmp flg1,6 jne p2 mov flg1,3 p2: call showdateall call movshu jmp R2k22: cmp al,q jne k23 jmp goesc k23: cmp al,m je function2 jmp R2 ret setdate endp addshu proc ;根据flg1调整时间日期 cmp flg1,0 jne t1 inc hour cmp hour,24 jne t6 mov hour,0t1: cmp flg1,1 jne t2 inc minute cmp minute,60 jne t6 mov minute,0t2: cmp flg1,2 jne t3 inc second cmp second,60 jne t6 mov second,0t3: cmp flg1,3 jne t4 inc year cmp year,10000 jne t6 mov year,1t4: cmp flg1,4 jne t5 inc mouth cmp mouth,13 jne t6 mov mouth,1t5: cmp flg1,5 jne t6 inc day cmp day,32 jne t6 mov day,1t6: ret addshu endp movshu proc cmp flg1,0 ;根据flg1显示时间日期调整对象 jne tt1 mov al,hour call showbuf showline sbuf,0,2,0b20H,000eHtt1: cmp flg1,1 jne tt2 mov al,minute call showbuf showline sbuf,0,2,0b23H,000eHtt2: cmp flg1,2 jne tt3 mov al,second call showbuf showline sbuf,0,2,0b26H,000eH tt3: cmp flg1,3 jne tt4 call yearbcd showline sbufy,0,4,0b20H,000eHtt4: cmp flg1,4 jne tt5 mov al,mouth call showbuf showline sbuf,0,2,0b25H,000eH tt5: cmp flg1,5 jne tt6 mov al,day call showbuf showline sbuf,0,2,0b28H,000eHtt6: ret movshu endpshowtimeall proc ;显示时间 mov al,hour call showbuf showline sbuf,0,2,0b20H,0004H mov al,minute call showbuf showline sbuf,0,2,0b23H,0004H mov al,second call showbuf showline sbuf,0,2,0b26H,0004H ret showtimeall endp showdateall proc near ;显示日期 call yearbcd showline sbufy,0,4,0b20h,0004h mov al,mouth call showbuf showline sbuf,0,2,0b25h,0004h mov al,day call showbuf showline sbuf,0,2,0b28h,0004h ret showdateall endp yearbcd proc near ;dw=0000 lea di, sbufy mov ax,year mov bx,1000 mov dx,0 div bx add al,30h

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论