《微机原理与接口技术》上机报告.doc_第1页
《微机原理与接口技术》上机报告.doc_第2页
《微机原理与接口技术》上机报告.doc_第3页
《微机原理与接口技术》上机报告.doc_第4页
《微机原理与接口技术》上机报告.doc_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

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

文档简介

微机原理与接口技术上机报告系 别: 机电工程学院指导教师: 王义琴 学 号:姓 名:微机原理与接口技术上机报告一系别机电工程学院学号080607307姓名段祖建日期2010/10/231.题目:信息显示程序的编写与调试2.上机目的:(1)掌握汇编程序的源程序的编辑、编译、连接、运行的过程。(2)深入了解数据在存储器中的存取方法。(4)掌握变量的定义及输入、输出指令的执行过程。3.上机内容:(1)设字符串的内容为“Welcome you to learn Assembly language !”,试编写程序将此内容显示在屏幕上。(参考教材第47页例2-1)(2)试编写程序将八个通用寄存器的内容显示在屏幕上。(参考教材第58页例2-2)4.程序流程图及算法简要描述:(1);080607307.asm include io32.inc .datamsg byteWelcome you to learn Assembly language!,13,10,0 .codestart: mov eax,offset msg call dispmsg exit 0 end start(2);eg0202.asm include io32.inc .dataCount dword 12345678h,9abcdef0h,0,0,3721h .codestart: mov eax,33221100h mov ebx,eax mov ecx,count mov ebx,offset count mov edx,ebx mov esi,ebx+4 mov esi,4 mov edi,countesi mov edi,ebx+esi mov ecx,ebx+esi*4 mov edx,ebx+esi*4-4 mov ebp,esp call disprd exit 0 end start5.上机结论:结论1结论2微机原理与接口技术上机报告二系别机电工程学院学号080607307姓名段祖建日期2010/10/231.题目:顺序程序设计(一)2.上机目的:(1)掌握顺序程序设计的一般方法。(2)熟练运用各种指令编程。3.上机内容:(1)变量地址属性程序。(参考教材第75页例3-5)(2)数据交换程序。(参考教材第78页例3-7)(3)换码程序。(参考教材第82页例3-9)4. 程序流程图及算法简要描述:(1) ;dzj.asm include io32.inc .data bvar byte 12h,34h org $+10 array word 1,2,3,4,5,6,7,8,9,10 wvar word 5678h arr_size=$-array arr_len=arr_size/2 dvar dword 9abcdef0h .codestart: mov al,bvar mov ah,bvar+1 mov bx,wvar2 mov ecx,arr_len mov edx,$ mov esi,offset dvar mov edi,esi mov ebp,dvar call disprd exit 0 end start(2) ;dzj1.asm include io32.inc .data num byte 6,7,7,8,3,0,0,0 tab byte 67783000 .codestart: mov ecx,lengthof num mov esi,offset num mov edi,offset tabagain: mov al,esi xchg al,edi mov esi,al call dispc add esi,1 add edi,1 loop again xchg eax,eax nop exit 0 end start(3) ;dzj2.asm include io32.inc .data num byte 6,7,7,8,3,0,0,0 tab byte 67783000 .codestart: mov ecx,lengthof num mov esi,offset num mov ebx,offset tabagain: mov al,esi xlat call dispc add esi,1 loop again exit 0 end start5.上机结论:结论1结论2结论3微机原理与接口技术上机报告三系别机电工程学院学号080607307姓名段祖建日期2010/10/301.题目:顺序程序设计(二)2.上机目的:同顺序程序设计(一)3.上机内容:(1)加法程序 6892H+1356H;(2)减法程序 6892H-1356H.4. 程序流程图及算法简要描述 (1) ;dzj3.asm include io32.inc .data wvar1 dword 00006892h wvar2 dword 00001356h .codestart: mov eax,wvar1 mov ebx,wvar2 add eax,ebx call disprd exit 0 end start(2) ;dzj4.asm include io32.inc .data wvar1 dword 00006892h wvar2 dword 00001356h .codestart: mov eax,wvar1 mov ebx,wvar2 sub eax,ebx call disprd exit 0 end start5.上机结论:结论1结论2微机原理与接口技术上机报告四系别机电工程学院学号080607307姓名段祖建日期2010/10/301.题目:分支程序设计(一)2.上机目的:(1)掌握分支程序的设计方法。(2)熟练运用转移指令实现分支,重点掌握JMP和条件转移指令在分支程序中的作用。3.上机内容:(1)英文小写字符转换成大写字符。(参考教材第86页例3-12)(2)两个数据大小比较。(参考教材第114页例4-5) 4. 程序流程图及算法简要描述:(1) ;dzj5.asminclude io32.inc.datamsgbyte welcome,0.codestart:mov ecx,(lengthof msg)-1mov ebx,0again:sub msgebx,a-Ainc ebxloop againmov eax,offset msgcall dispmsgexit 0end start(2) ;dzj6.asminclude io32.inc.datain_msg1byte Enter a number: ,0in_msg2byte Enter another number: ,0out_msg1 byte Two numbers are equal: ,0out_msg2 byte The less number is: ,0out_msg3 byte 13,10,The greater number is: ,0.codestart: mov eax,offset in_msg1 call dispmsg call readsid mov ebx,eax mov eax,offset in_msg2 call dispmsg call readsid mov ecx,eax cmp ebx,ecx jne nequal mov eax,offset out_msg1call dispmsgmov eax,ebx call dispsid jmp done nequal: jl first xchg ebx,ecx first: mov eax,offset out_msg2 call dispmsg mov eax,ebx call dispsid mov eax,offset out_msg3 call dispmsg mov eax,ecx call dispsid done:exit 0end start5.上机结论:结论1结论2微机原理与接口技术上机报告五系别机电工程学院学号080607307姓名段祖建日期2010/11/201.题目:分支程序设计(二)2.上机目的:同上3.上机内容: (1)统计数组中的正数、负数、0的个数。(2)统计10个学生的成绩。4.程序流程图及算法简要描述:(1);dzj8.asm include io32.inc .dataarray dword 12,36,-134,0,0,-45,67,1,0,-12arr byte ,0sum1 dword 0sum2 dword 0sum3 dword 0out1 byte the sum of positive number is:,0out2 byte the sum of negative number is:,0out3 byte the sum of zero number is:,0 .codestart: mov ecx,lengthof array xor eax,eax xor ebx,ebx again: mov eax,arrayebx*4 inc ebx call dispsid mov eax,offset arr call dispmsg loop again xor eax,eax mov ebx,eax mov ecx,lengthof arrayagain1: mov eax,arrayebx*4 inc ebx cmp eax,0 jg num1 jz num2 jl num3num1: inc sum1 jmp skknum2: inc sum2 jmp skknum3: inc sum3skk: loop again1 call dispcrlf mov eax,offset out1 call dispmsg mov eax,sum1 call dispuid(2);dzj8a.asminclude io32.inc extern read:near,write:near,mean:near public temp includelib eg0419.lib.datacount= 10arraydword count dup(0)tempdword ?msg1byte Enter the 10 mark: ,13,10,0msg2byte The mean is: ,0.codestart: mov eax,offset msg1 call dispmsgxor ebx,ebx mov ecx,count again: call read mov eax,temp mov array ebx*4,eax add ebx,1cmp ebx,countjb again push ecx push offset array call mean add esp,8 mov ebx,eax mov eax,offset msg2 call dispmsg mov eax,ebx call write exit 0end start5.上机结论:结论1 结论2微机原理与接口技术上机报告六系别机电工程学院学号080607307姓名段祖建日期2010/11/141.题目:循环程序设计(一)2.上机目的:(1)掌握循环程序的设计方法。(2)熟练运用转移指令和循环指令。(3)掌握循环计数ECX的作用。(4)在多重循环中,要注意内层与外层的循环计数的独立性。3.上机内容:(1)加密解密程序。(参考教材第119页例4-11)(2)在屏幕上用十六进制数显示一个十六位的二进制数。(参考教材第125页例4-15)4.程序流程图及算法简要描述:(1);dzj9.asminclude io32.inc.datakeybyte 234bufnum= 255buffer byte bufnum+1 dup(0) msg1byte Enter messge: ,0msg2byte Encrypted message: ,0msg3byte 13,10,Original messge: ,0.codestart: mov eax,offset msg1 call dispmsg mov eax,offset buffer call readmsg push eax mov ecx,eax xor ebx,ebx encrypt: mov al,key xor bufferebx,al inc ebx dec ecx jnz encrypt mov eax,offset msg2call dispmsg mov eax,offset buffer call dispmsg pop ecx xor ebx,ebx decrypt: mov al,key xor bufferebx,al inc ebxdec ecx jnz decrypt mov eax,offset msg3call dispmsg mov eax,offset buffer call dispmsgexit 0end start(2);dzj10.asminclude io32.inc.dataregdbyte EAX=,8 dup(0),H,0.codestart:mov eax,1234abcdhxor ebx,ebx mov ecx,8 again:rol eax,4push eax call htoasc mov regd+4ebx,alpop eaxinc ebxdec ecxjnz againmov eax,offset regd call dispmsg exit 0htoasc proc and al,0fh or al,30h cmp al,39h jbe htoend add al,7 htoend: ret htoasc endp end start5.上机结论:结论1 结论2 微机原理与接口技术上机报告七系别机电工程学院学号080607307姓名段祖建日期2010/11/161.题目:循环程序设计(二)2.上机目的:同上3.上机内容:(1)有符号数十进制显示程序。(参考教材第127页例4-16)(2)从键盘输入有符号十进制数。(参考教材第128页例4-17)(3)求十个有符号数的平均值。(参考教材第131页例4-18)4.程序流程图及算法简要描述:(1);dzj11.asminclude io32.inc.dataArray dword 1234567890,-1234,0,1,-987654321,32767,-32768,5678,-5678,9000writebuf byte 12 dup(0) .codestart:mov ecx,lengthof arraymov ebx,0again: mov eax,arrayebx*4 call write call dispcrlf inc ebxdec ecxjnz againexit 0write proc push ebx push ecxpush edx mov ebx,offset writebuf test eax,eax jnz write1 mov byte ptr ebx,0 inc ebx jmp write5 write1: jns write2 mov byte ptr ebx,- inc ebx neg eaxwrite2:mov ecx,10 push ecx write3: cmp eax,0 jz write4 xor edx,edx div ecx add edx,30h push edx jmp write3write4: pop edx cmp edx,ecx je write5 mov ebx,dl inc ebxjmp write4write5:mov byte ptr ebx,0mov eax,offset writebufcall dispmsg pop edx pop ecxpop ebx ret writeendpend start(2);dzj12.asminclude io32.inc.datacount= 10arraydword count dup(0)tempdword ?readbufdb 30 dup(0).codestart:mov ecx,countmov ebx,offset arrayagain:call readmov eax,tempmov ebx,eaxadd ebx,4dec ecxjnz againexit 0readprocpush eaxpush ebxpush ecxpush edxread0:mov eax,offset readbufcall readmsgtest eax,eaxjz readerrcmp eax,12ja readerrmov edx,offset readbufxor ebx,ebxxor ecx,ecxmov al,edxcmp al,+jz read1cmp al,-jnz read2mov ecx,-1read1:inc edxmov al,edxtest al,aljz read3read2:cmp al,0jb readerrcmp al,9ja readerrsub al,30himul ebx,10jc readerrmovzx eax,aladd ebx,eaxcmp ebx,80000000hjbe read1readerr:mov eax,offset errmsgcall dispmsgjmp read0read3:test ecx,ecxjz read4neg ebxjmp read5read4:cmp ebx,7fffffffhja readerrread5:mov temp,ebxpop edxpop ecxpop ebxpop eaxreterrmsgbyte Input error, enter again: ,0readendpend start(3);dzj13.asminclude io32.inc.dataarraydword 675, 354, -34, 198, 267, 0, 9, 2371, -67, 4257.codestart: push lengthof array push offset array call mean add esp,8 call dispsid exit 0mean proc push ebp mov ebp,esp push ebx push ecxpush edx mov ebx,ebp+8 mov ecx,ebp+12 xor eax,eax xor edx,edx mean1: add eax,ebx+edx*4 add edx,1 cmp edx,ecx jb mean1 cdq idiv ecx pop edxpop ecxpop ebxpop ebpretmeanendpend start5.上机结论:结论1 结论2 结论3微机原理与接口技术上机报告八系别机电工程学院学号080607307姓名段祖建日期2010/11/191.题目:子程序设计(一)2.上机目的:了解子程序的设计方法,熟悉子程序的结构、调用。3.上机内容:(1)数据输入输出程序。(参考教材第133页例4-19)(2)从键盘输入无符号十进制数。(参考教材第128页例4-17)(3)求十个无符号数的平均值。(参考教材第131页例4-18)4.程序流程图及算法简要描述:(1) ;dzj14.asminclude io32.incextern read:near,write:near,mean:near public temp includelib eg0419.lib.datacount= 10arraydword count dup(0)tempdword ?msg1byte Enter 10 numbers: ,13,10,0msg2byte The mean is: ,0.codestart: mov eax,offset msg1 call dispmsgxor ebx,ebx mov ecx,count again: call read mov eax,temp mov array ebx*4,eax add ebx,1cmp ebx,countjb again push ecx push offset array call mean add esp,8 mov ebx,eax mov eax,offset msg2 call dispmsg mov eax,ebx call write exit 0end start(2);dzj15.asminclude io32.inc.datacount= 5arraydword count dup(0)tempdword ?readbufdb 30 dup(0).codestart:mov ecx,countmov ebx,offset arrayagain: call read mov eax,temp mov ebx,eax add ebx,4dec ecxjnz againexit 0read proc push eax push ebx push ecxpush edxread0:mov eax,offset readbuf call readmsg

温馨提示

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

评论

0/150

提交评论