




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、微机原理课程设计姓名 李永尚 班级 电科0902 学号 3090504054 学院 电气学院 一、实验目的结合微型计算机原理课程的学习,进一步巩固已学习知识,同时针对计算机原理知识的具体应用,学会对系统中dos和bios的 使用。学会使用编辑程序edit,弄懂汇编程序的上机过程以及如何运用tdebug软件进行汇编程序的调试。二、实验内容1、从键盘输入数据并显示设计编写程序,将键盘接收到的4位十六进制数转换为等值的二进制数,再显示在屏幕上2、响铃设计 为掌握响铃的使用方法。编写程序,从键盘输入字符,如果是数字n则响铃n次;如果不是数字,则不响铃。3、字符串匹配设计 编写程序实现两个字符串的比较.
2、如相同,则显示”match”,否则,显示“no match”.4、将键盘输入的小写字母转换成大写字母的设计 接收键盘字符(-c为结束),并将其中的小写字母转换为大写字母,然后显示在屏幕上5、计算n!设计编写计算n!的程序。数值n由键盘输入,将结果在屏幕上输出。n的范围为0-65535.即刚好能被一个16位寄存器容纳。1、从键盘输入数据并显示设计流程图入口段寄存器和堆栈初始化显示“请输入十六进制数”调用getnum接收键入数值,保存在bx中计数值16送cxb x中内容循环左移1位bl送dl,屏蔽掉dl高7位dl加30h,变成二进制数位对应字符的ascii显示cx减1为0? n返回dos程序crl
3、fmacromov ah,02hmovdl,0dhint21hmovah,02hmovdl,0ahint 21h endmdatasegmentmessdbinput hexnumber:$error db input error!,0dh,0ah,$data endsstacksegmentstadw32 dup(?)topdw?stackendscodesegmentassumecs:code,ds:data,es:data,ss:stackstart:movax,datamovds,axmoves,axmovsp,topmovah,09hmovdx,offsetmessint21hcal
4、lgetnummovcx,0010hmovbx,dxttt:rolbx,1movdl,blanddl,01hadddl,30hmovah,02hint21hlooptttmovax,4c00hint21hgetnumprocnearpushcxxordx,dxggg:movah,01hint 21hcmpal,0dhjzpppcmpal,20hjzpppcmpal,30hjbkkksubal,30hcmpal,0ahjbgetscmpal,11hjbkkksubal,07hcmpal,0fhjbegetscmpal,2ahjbkkkcmpal,2fhjakkksubal,20hgets:mov
5、cl,04shldx,clxorah,ahadddx,axjmpgggkkk:movah,09hmovdx,offseterrorint21hppp:pushdxcrlfpopdxpopcxretgetnumendpcodeendsendstart运行结果:2、响铃设计流程图 程序crlf macro mov ah,02h mov dl,0dh int 21h mov ah,02h mov dl,0ah int 21h endm datasegmentbuf db 80 dup(?)data endsstacksegmentsta db 50 dup(?)top equ length stas
6、tack endscode segmentassume cs:code,ds:data,es:data,ss:stackstart: mov ax,data mov ds,axmov es,ax mov ax,stackmov ss,ax mov sp,top kkk: mov ah,01hint 21hcmp al,03hjz pppcmp al,30hjbe tttcmp al,39hja ttt, sub al,30hxor ah,ahmovbp,axggg:mov ah,02hmovdl,07hint21hmovcx,6000huuu:loop uuudecbpjnzgggttt:jm
7、pkkkppp:movax,4c00hint21hcodeends end start运行结果:3、字符串匹配设计流程图 程序crlf macro mov dl,0dh mov ah,02h int 21h mov ah,02h mov dl,0ah int 21h endmdata segmentmess1 db match,0dh,0ah,$mess2 db no match,0dh,0ah,$mess3 db input string1!,0dh,0ah,$mess4 db input string2!,0dh,0ah,$maxlen1 db 100string1 db 100 dup(
8、?)maxlen2 db 100string2 db 100 dup(?)data endscode segmentassume cs:code,ds:data,es:datastart: mov ax,data mov ds,ax mov es,ax mov ah,09h mov dx,offset mess3 int 21h mov al,maxlen1 mov bx,offset string1 mov bx,al mov ah,0ah mov dx,offset string1 int 21h crlf mov ah,09h mov dx,offset mess4 int 21h mo
9、v al,maxlen2 mov bx,offset string2 mov bx,al mov ah,0ah mov dx,offset string2 int 21h crlfcld lea si,string1 mov cl,si+1 mov ch,0being: lea di,string2 mov dl,di+1 mov dh,0j1: mov al,si+2 cmp di+2,al je j3 j2: inc di dec dx jz nomat jmp j1 j3: dec cx jz match dec dx jz nomat inc si inc di mov al,si+2
10、 cmp di+2,al je j3 dec dx jz nomat lea si,string1 mov cl,si+1 mov ch,0 jmp j1match: mov ah,09h mov dx,offset mess1 int 21h jmp nextnomat: mov ah,09h mov dx,offset mess2 int 21h next: mov ah,4ch int 21hcode ends end start 运行结果:4、将键盘输入的小写字母转换成大写字母的设计流程图入口段寄存器和堆栈初始化bx指向字符缓冲区首址偏移指针si清0用int 21h的01h功能接收键入
11、字符是-c键是回车键是小写字母小写字母的ascii码值转换为大写字母的ascii值存入字符行缓冲区bx+si单元si 加1指向下一单元显示转换后的字符行缓冲区内容返回doscrlfmacromovah,02hmovdl,0dhint21hmovah,02hmovdl,0ahint21hendmdatasegmentbufdb 82 dup(?)dataendsstacksegmentstadb 50 dup(?)topequ length stastack endscodesegmentassumecs:code,ds:data,es:data,ss:stackstart:movax,data
12、movds,axmoves,axmovax,stackmovss,axmovsp,topmovbx,offset bufkkk:movsi,0000hggg:movah,01hint21hcmpal,03hjzpppcmpal,0dhjzbbbcmpal,61hjbtttcmpal,7ahjatttsubal,20httt:movbx+si,alincsijmpgggbbb:movbx+si,almoval,0ahmovbx+si+1,almoval,$movbx+si+2,almovah,09hmovdx,bxint21hjmpkkkppp:movax,4c00hint21hcodeends
13、endstart运行结果:按回车键后5、计算n!设计流程图程序crlf macro mov ah,02h mov dl,0dh int 21h mov ah,02h mov dl,0ah int 21hendmdata segmentmess1 db input the number according to hexnum!,0dh,0ah,$mess2 db the result is(hex):$error db input error!,0dh,0ah,$len dw 1cy dw ?buf dw 256 dup (0)data endsstack segmentsta dw 32 du
14、p(?)top dw ?stack endscode segmentassume cs:code,ds:data,es:data,ss:stackstart: mov ax,data mov ds,ax mov es,ax mov sp,top mov ah,09h mov dx,offset mess1 int 21h call getnum mov bp,dx cmp bp,0 jz eee cmp bp,1 jz eee mov si,offset buf mov si,dx xxx: dec bp cmp bp,0001h jz lll xor bx,bx mov word ptr c
15、y,0 mov cx,len ttt: mov ax,si+bx mul bp add ax,cy jnc jjj inc dx jjj: mov si+bx,ax mov cy,dx inc bx inc bx loop ttt cmp dx,0000h jz bbb inc word ptr len mov si+bx,dx bbb: jmp xxxeee: mov si,offset buf mov word ptr si,1 lll: mov ah,09h mov dx,offset mess2 int 21h mov cx,len mov bx,cx dec bx shl bx,1
16、ccc: mov ax,si+bx call disp dec bx dec bx loop ccc jmp start mov ax,4c00h int 21hdisp1 proc near mov bl,al mov dl,al mov cl,04 rol dl,cl and dl,0fh call displ mov dl,bl and dl,0fh call displ retdisp1 endpdispl proc near add dl,30h cmp dl,3ah jb ddd add dl,27hddd: mov ah,02h int 21h retdispl endpdisp
17、 proc near push bx push cx push dx push ax mov al,ah call disp1 pop ax call disp1 pop dx pop cx pop bx retdisp endp getnum proc near push cx xor dx,dxggg: mov ah,01h int 21h cmp al,0dh jz ppp cmp al,20h jz ppp sub al,30h jb kkk cmp al,0ah jb gets cmp al,11h jb kkk sub al,07h cmp al,0fh jbe gets cmp al,2ah jb kkk cmp al,2fh ja kkk sub al,20hgets: mov cl,04 shl dx,cl xor ah,ah add dx,ax jmp gggkkk: mov ah,09h mov dx,offset error int 21hppp: push dx crlf pop dx pop cx retgetnum endp code endsend start心得: 转眼间为期一周的微机课程设计就要结束了,因为微机原理这门课是上个学期学习的,很多的知识点已经忘记了,但好在还记得一些,通过课后学习,查阅各种资料,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 街道消防安全事件的应急预案
- 表设备采购招标文件
- 江苏省南通市海安高级中学2024-2025学年高一下学期6月阶段检测地理试卷(含答案)
- 河北省石家庄市第四十中学2024-2025学年七年级下学期期中生物试题(含答案)
- 财务会计子系统的解决方案(一)
- 2025年广东省深圳市育才二中中考英语三模试卷(含答案)
- 幼儿心理学教案得力文库
- 2024-2025学年下学期高二生物人教版期末必刷常考题之种群及其动态
- 2024-2025学年下学期高一生物沪科版期末必刷常考题之基因重组造成变异的多样性
- 建筑施工特种作业-建筑起重机械安装拆卸工(施工升降机)真题库-4
- 新修订《黄河保护法》PPT
- 北斗卫星导航发展及其的应用课件
- 过敏性休克应急预案演练记录表
- 第八章-三相异步电动机的电力拖动课件
- 工程施工停止点检查表
- 《灭火器维修》GA95-2015(全文)
- 高中美术素描教案(8篇)
- 市政工程监理规划范本(完整版)
- 国贸实验一进出口价格核算
- 幼儿园中班美术:《美丽的蝴蝶》 PPT课件
- 单片机芯片8279用法
评论
0/150
提交评论