微机原理课程设计万年历_第1页
微机原理课程设计万年历_第2页
微机原理课程设计万年历_第3页
微机原理课程设计万年历_第4页
微机原理课程设计万年历_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

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

文档简介

1、微机原理课程设计万年历的制作目录实验目的··············································

2、3;··········(3)实验内容······································

3、83;··················(3)实验流程图······························&

4、#183;························(3)实验程序························

5、·································(5)调试结果················

6、;········································(11)心得体会········

7、83;················································(14)实验目的:

8、结合微型计算机原理课程的学习,进一步巩固已学习的知识,同时针对微型计算机原理知识的具体应用,学会对系统中的DOS和BIOS的使用。学会使用编写软件EDIT,弄懂汇编程序的上机过程以及如何运用DEBUG软件进行汇编程序的调试。通过单步调试,加深对汇编语言的内容了解。实验内容:接受年月日信息并显示,编写程序,先显示“What is the data?”,并响铃一次,然后再显示year,接收键盘输入的年,输入正确后,显示month,从键盘输入月,输入正确后,再显示day,从键盘输入日期的信息,并显示。对于时间的算法,闰年时,二月有29天,而平年,二月有28天,其它月份有30天或是31天。若输入年月日

9、时产生错误,警告并重新输入。实验流程图:入口段寄存器初始化和堆栈初始化显示“What is the data?”输出响铃,延迟1s调用getnum,接收键入的年,月,日信息调用dispyear,显示年输出字符“-”调用dispmonth,显示月输出字符“-”调用dispday,显示日返回DOS子程序getnum流程图:入口输入年份四位XXXX错误信息年份输入是否合理?Y输入月份二位XXN月份输入是否合理?错误信息Y日期输入二位XXN输入合理?错误信息YN是二月份?YN是闰年吗?Y日期输入合理N日期输入合理吗NYY返回实验程序:assume cs:code,ds:datadata segment

10、cr equ 0dhlf equ 0ahstring1 db 'What is the data?','$'string2 db cr,lf,'Year :','$'string3 db cr,lf,'Month :','$'string4 db cr,lf,'Day :','$'string5 db cr,lf,'ERROR! Input again:','$' buff1 db 5 db ? db 5 dup(?) buff2 db

11、 3 db ? db 3 dup(?) buff3 db 3 db ? db 3 dup(?) data endscode segment start:mov ax,data mov ds,ax mov dx,offset string1 mov ah,9 int 21h call delay call warning call delay call getnum mov dl,0dh mov ah,02h int 21h mov dl,0ah mov ah,02h int 21h call dispyear mov dl,'-' mov ah,02h int 21h call

12、 dispmonth mov dl,'-' mov ah,02h int 21h call dispday mov ax,4c00h int 21hgetnum proc near repea0:mov dx,offset string2 mov ah,9 int 21h mov dx,offset buff1 mov ah,0ah int 21h mov cx,4 mov si,offset buff1 inc si check:inc si mov al,si sub al,30h mov ah,0h cmp ax,9h ja repea cmp ax,0h jb repe

13、a loop checkmov si,offset buff1mov ah,'$'mov si+6,ahjmp repeat0 repea:call error call warningjmp repea0 repeat0:mov dx,offset string3 mov ah,9 int 21h mov dx,offset buff2 mov ah,0ah int 21h mov si,offset buff2 call address cmp al,0dh jz repeat01 cmp ax,12h ja repeat01 cmp ax,0 jbe repeat01mo

14、v si,offset buff2mov ah,'$'mov si+4,ahjmp repeat1repeat01:call errorcall warningjmp repeat0repeat1:mov dx,offset string4 mov ah,9 int 21h mov dx,offset buff3 mov ah,0ah int 21h mov si,offset buff3 call address cmp ax,31h ja repeat11 cmp ax,0 jbe repeat11 mov si,offset buff2 call address cmp

15、ax,2h jz feb mov dl,2 div dl cmp ah,0h jz doumonth mov si,offset buff2 call address cmp ax,8h ja downmonth1 jmp overdoumonth:mov si,offset buff2 call address cmp ax,7h ja downmonth2 mov si,offset buff3 call address cmp ax,31h jz repeat11 jmp overdownmonth2:jmp overrepeat11:call errorcall warningjmp

16、repeat1 downmonth1:mov si,offset buff3 call address cmp ax,31h jz repeat11 jmp over feb:mov si,offset buff1 inc si inc si mov dx,si sub dh,30h sub dl,30h mov cl,4 rol dl,cl add dl,dh mov dh,0 mov cl,8 rol dx,cl call address cmp ax,0 jz hundard add ax,dxmov bl,alnextdiv:mov al,ah mov ah,0 mov cl,4 di

17、v cl add ah,2 cmp ah,3 ja nextdiv mov al,bladd al,2 div cl cmp ah,0h jz leapyearcommonyear:mov si,offset buff3 call address cmp ax,28h ja repeat11 cmp ax,0 jbe repeat11 jmp overleapyear:mov si,offset buff3 call address cmp ax,29h ja repeat11 cmp ax,0 jbe repeat11 jmp over hundard:mov al,dh mov ah,0

18、add ax,2 mov dl,4 div dl cmp ah,0h jz leapyear jmp commonyear over:mov si,offset buff3mov ah,'$'mov si+4,ahret getnum endpdispyear proc near mov dx,offset buff1 inc dx inc dx mov ah,9 int 21h retdispyear endpdispmonth proc near mov dx,offset buff2 inc dx inc dx mov ah,9 int 21h retdispmonth

19、endpdispday proc near mov dx,offset buff3 inc dx inc dx mov ah,9 int 21h retdispday endpaddress proc nearinc si inc si mov ax,si sub ah,30h sub al,30h mov cl,4 rol al,cl add al,ah mov ah,0 retaddress endpdelay proc near push ax push dx mov dx,5020h;近1秒 mov ax,0 s1:sub ax,1 sbb dx,0 cmp ax,0 jne s1 cmp dx,0 jne s1 pop dx pop ax retdelay endp error proc nearpush dxpush axmov dx,offset string5mov ah,9int 21hpop axpop dxreterror endp warning proc nearpush dxpush axmov dl,07h mov ah,2 int

温馨提示

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

评论

0/150

提交评论