《微機原理與接口技術》上機報告.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

提交評論