微機接口課程設(shè)計_第1頁
微機接口課程設(shè)計_第2頁
微機接口課程設(shè)計_第3頁
微機接口課程設(shè)計_第4頁
微機接口課程設(shè)計_第5頁
已閱讀5頁,還剩17頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、微機原理課程設(shè)計姓名 李永尚 班級 電科0902 學(xué)號 3090504054 學(xué)院 電氣學(xué)院 一、實驗?zāi)康慕Y(jié)合微型計算機原理課程的學(xué)習(xí),進一步鞏固已學(xué)習(xí)知識,同時針對計算機原理知識的具體應(yīng)用,學(xué)會對系統(tǒng)中dos和bios的 使用。學(xué)會使用編輯程序edit,弄懂匯編程序的上機過程以及如何運用tdebug軟件進行匯編程序的調(diào)試。二、實驗內(nèi)容1、從鍵盤輸入數(shù)據(jù)并顯示設(shè)計編寫程序,將鍵盤接收到的4位十六進制數(shù)轉(zhuǎn)換為等值的二進制數(shù),再顯示在屏幕上2、響鈴設(shè)計 為掌握響鈴的使用方法。編寫程序,從鍵盤輸入字符,如果是數(shù)字n則響鈴n次;如果不是數(shù)字,則不響鈴。3、字符串匹配設(shè)計 編寫程序?qū)崿F(xiàn)兩個字符串的比較.

2、如相同,則顯示”match”,否則,顯示“no match”.4、將鍵盤輸入的小寫字母轉(zhuǎn)換成大寫字母的設(shè)計 接收鍵盤字符(-c為結(jié)束),并將其中的小寫字母轉(zhuǎn)換為大寫字母,然后顯示在屏幕上5、計算n!設(shè)計編寫計算n!的程序。數(shù)值n由鍵盤輸入,將結(jié)果在屏幕上輸出。n的范圍為0-65535.即剛好能被一個16位寄存器容納。1、從鍵盤輸入數(shù)據(jù)并顯示設(shè)計流程圖入口段寄存器和堆棧初始化顯示“請輸入十六進制數(shù)”調(diào)用getnum接收鍵入數(shù)值,保存在bx中計數(shù)值16送cxb x中內(nèi)容循環(huán)左移1位bl送dl,屏蔽掉dl高7位dl加30h,變成二進制數(shù)位對應(yīng)字符的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運行結(jié)果:2、響鈴設(shè)計流程圖 程序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運行結(jié)果:3、字符串匹配設(shè)計流程圖 程序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

8、db 'input string2!',0dh,0ah,'$'maxlen1 db 100string1 db 100 dup(?)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,

9、0ah mov dx,offset string1 int 21h crlf mov ah,09h mov dx,offset mess4 int 21h mov 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

10、dx jz nomat jmp j1 j3: dec cx jz match dec dx jz nomat inc si inc di mov al,si+2 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

11、 運行結(jié)果:4、將鍵盤輸入的小寫字母轉(zhuǎn)換成大寫字母的設(shè)計流程圖入口段寄存器和堆棧初始化bx指向字符緩沖區(qū)首址偏移指針si清0用int 21h的01h功能接收鍵入字符是-c鍵是回車鍵是小寫字母小寫字母的ascii碼值轉(zhuǎn)換為大寫字母的ascii值存入字符行緩沖區(qū)bx+si單元si 加1指向下一單元顯示轉(zhuǎn)換后的字符行緩沖區(qū)內(nèi)容返回doscrlfmacromovah,02hmovdl,0dhint21hmovah,02hmovdl,0ahint21hendmdatasegmentbufdb 82 dup(?)dataendsstacksegmentstadb 50 dup(?)topequ lengt

12、h stastack endscodesegmentassumecs:code,ds:data,es:data,ss:stackstart:movax,datamovds,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,

13、almoval,$movbx+si+2,almovah,09hmovdx,bxint21hjmpkkkppp:movax,4c00hint21hcodeendsendstart運行結(jié)果:按回車鍵后5、計算n!設(shè)計流程圖程序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

14、(hex):$'error db 'input error!',0dh,0ah,'$'len dw 1cy dw ?buf dw 256 dup (0)data endsstack segmentsta dw 32 dup(?)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 get

15、num 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 cy,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:

16、 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 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 a

17、nd 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 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

18、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心得: 轉(zhuǎn)眼間為期一周的微機課程設(shè)計就要結(jié)束了,因為微機原理這門課是上個學(xué)期學(xué)習(xí)的,很多的知識點已經(jīng)忘記了,但好在還記得一些,通過課后學(xué)習(xí),查

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論