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

下载本文档

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

文档简介

1、微机原理课程设计万年历的制作目录实验目的(3)实验内容(3)实验流程图(3)实验程序(5)调试结果(11)心得体会(14)实验目的:结合微型计算机原理课程的学习, 进一步巩固已学习的知识, 同时针对微型 计算机原理知识的具体应用,学会对系统中的 DOS和 BIOS的使用。学会使用编 写软件 EDIT,弄懂汇编程序的上机过程以及如何运用 DEBUG软件进行汇编程序 的调试。通过单步调试,加深对汇编语言的内容了解。实验内容:接受年月日信息并显示, 编写程序,先显示“What is the data?”,并响铃一次, 然后再显示 year,接收键盘输入的年, 输入正确后,显示 month ,从键盘输

2、入月, 输入正确后,再显示 day,从键盘输入日期的信息,并显示。对于时间的算法, 闰年时,二月有 29天,而平年,二月有 28天,其它月份有 30 天或是 31 天。若 输入年月日时产生错误,警告并重新输入。实验流程图:返回 DOS子程序 getnum 流程图:N实验程序:assume cs:code,ds:data data segmentcr equ 0dhlf equ 0ahstring1 db What is the data?,$string2 db cr,lf,Year :,$string3 db cr,lf,Month :,$string4 db cr,lf,Day :,$st

3、ring5 db cr,lf,ERROR! Input again:,$buff1 db 5db ?db 5 dup(?)buff2 db 3db ?db 3 dup(?)buff3 db 3db ?db 3 dup(?)data endscode segmentstart:mov ax,datamov ds,axmov 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

4、21h call dispyear mov dl,- mov ah,02h int 21h call dispmonth mov dl,- mov ah,02h int 21hcall dispdaymov ax,4c00hint 21h getnum proc near repea0:mov dx,offset string2mov ah,9int 21hmov dx,offset buff1 mov ah,0ah int 21h mov cx,4 mov si,offset buff1 inc si check:inc simov al,sisub al,30hmov ah,0hcmp a

5、x,9hja repeacmp ax,0hjb repealoop checkmov si,offset buff1mov ah,$ mov si+6,ah jmp repeat0 repea:call errorcall warningjmp repea0 repeat0:mov dx,offset string3 mov ah,9 int 21h mov dx,offset buff2 mov ah,0ah int 21hmov si,offset buff2 call address cmp al,0dh jz repeat01 cmp ax,12h ja repeat01 cmp ax

6、,0 jbe repeat01mov si,offset buff2mov ah,$mov si+4,ah jmp repeat1repeat01:call errorcall warning jmp repeat0 repeat1:mov dx,offset string4 mov ah,9 int 21hmov dx,offset buff3 mov ah,0ah int 21hmov si,offset buff3 call addresscmp ax,31h ja repeat11cmp ax,0jbe repeat11mov si,offset buff2call address c

7、mp ax,2h jz febmov dl,2div dl cmp ah,0h jz doumonth mov si,offset buff2 call address cmp ax,8h ja downmonth1 jmp over doumonth:mov si,offset buff2 call address cmp ax,7h ja downmonth2 mov si,offset buff3 call address cmp ax,31h jz repeat11 jmp over downmonth2:jmp over repeat11:call errorcall warning

8、 jmp repeat1 downmonth1:mov si,offset buff3 call address cmp ax,31h jz repeat11 jmp over feb:mov si,offset buff1 inc siinc 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,al nextdiv:mov al,ahmov ah,0mov cl,4

9、div cladd ah,2cmp ah,3ja nextdivmov al,bladd al,2div clcmp ah,0hjz leapyear commonyear:mov si,offset buff3call addresscmp ax,28h ja repeat11cmp ax,0 jbe repeat11 jmp over leapyear:mov si,offset buff3call addresscmp ax,29hja repeat11 cmp ax,0 jbe repeat11 jmp over hundard:mov al,dhmov ah,0 add ax,2 m

10、ov dl,4 div dl cmp ah,0h jz leapyear jmp commonyear over:mov si,offset buff3 mov ah,$ mov si+4,ah ret getnum endp dispyear proc nearmov dx,offset buff1 inc dx inc dx mov ah,9int 21hret dispyear endp dispmonth proc nearmov dx,offset buff2inc dxinc dx mov ah,9int 21hret dispmonth endp dispday proc nea

11、rmov dx,offset buff3inc dxinc dx mov ah,9int 21hretdispday endp address proc nearinc siinc si mov ax,si sub ah,30h sub al,30hmov cl,4rol al,cladd al,ahmov ah,0ret address endp delay proc nearpush axpush dxmov dx,5020h ;近 1秒mov ax,0s1:sub ax,1sbb dx,0cmp ax,0jne s1cmp dx,0jne s1pop dx pop axretdelay

12、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 21h pop ax pop dx retwarning endpcode ends end start调试结果: 响铃前:响铃后:输入实例:5 G:PROGRAlJMSOFTMasmbinDWTemp.exeO回 Z输入错误信息:IJhat is the data?Vear :12 EBROP

13、TnPIIt Vear :14 FRRORt InPiIt Vear :0r ERROKf InPUt Vear :15 ERROR? InPUt Vear :456 ERROR? InPUt Vear :tra hHR0R? InPiIt Vear :1900 IIontk :2 OFRROPt InDIIt Mont :21 ERRORt InPlIt IOnt)I :11 Day :36 ERROEt InPUt Dy :31 RR0B? InPiIt D&y :again: Again: again: xgln again: again:again: again-again: agai

14、n:勁 GPROGRA-lJMSOFMasmbinDWTemp.exeat is the data? ear :1000nth :12V :3RRORf ay :4 RROR?ROR!InPUtI nptagain:ay :6 RROR? y ? RROR?ay :8 RROR? ay :9 RROR?y :0 RORt y 1 RORf y :2InPUtInPUtInPUtInPUtInPUtInPUtI npu tI nptagain:again:again:again:again:acfaln :again again:心得体会:通过短短几天的课程设计, 让我重新拿起已经学习的微机原理

15、理论知识。 相 比一年前的程序的编写, 现在的我, 对于程序的流程理解和汇编语言的运用, 更 加灵活,更加通顺,渐渐的得心应手。相比较单片机的课程设计而言,我更加喜 欢微机原理的编程设计,感觉它功能更加强大,特点鲜明,还可以单步调试,类 似顺序执行的程序化语言的让我不由自主的爱上它, 喜欢去编程, 而单片机的运 行,各个模块之间相互调用, 总是给人一种摸不到头绪, 杂乱无章的感觉。 但是, 另一方面,短暂的课程设计,不得不给人留下很多的遗憾。首先,十三个题目, 做起来非常多, 假如只选四个, 又会放弃很多有用的功能, 要想每一个均独立完 成,并都做到尽善尽美,花的时间远远不止是四天的时间,需要平时,课下的钻 研,体会,实践,只有这样,才能体会汇编语言的强大。然后,课程设计的内

温馨提示

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

评论

0/150

提交评论