




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、實驗一:輸出字符 a的源程序如下:prog segment assume cs:prog start: mov dl,a mov ah , 2 int 21h mov ah , 4ch int 21h prog ends end start 實驗二:1. 把 bx中的二進制數(shù)轉(zhuǎn)換成十進制數(shù),在屏幕上顯示出來,只考慮無符號數(shù)。程序如下: code segment assume cs:code start: mov bx,0fffh mov cx,10000 call dec_div mov cx, 1000 call dec_div mov cx,100 call dec_div mov cx,
2、10 call dec_div mov cx,1 call dec_div mov ah,4ch int 21h dec_div proc near mov ax,bx mov dx,0 div cx mov bx,dx mov dl,al add dl,30h mov ah,2 int 21h ret dec_div endp code ends end start 2. 把 bx中的帶符號數(shù)轉(zhuǎn)換成十進制數(shù),在屏幕上顯示出來。程序如下: code segment assume cs:code start: mov bx,8001h mov ax,8000h and ax,bx jnz min
3、us jmp disp minus: mov dl,- mov ah,2 int 21h neg bx jmp disp disp: mov cx,10000 call dec_div mov cx, 1000 call dec_div mov cx,100 call dec_div mov cx,10 call dec_div mov cx,1 call dec_div mov ah,4ch int 21h dec_div proc near mov ax,bx mov dx,0 div cx mov bx,dx mov dl,al add dl,30h mov ah,2 int 21h r
4、et dec_div endp code ends end start 3. 求一個數(shù)據(jù)塊(由10 個單字節(jié)的無符號數(shù)組成)中的最大元素,并將結(jié)果在屏幕上顯示出來,程序如下: data segment block db 1,0,5,7,10,30,100,127,90,80 result db ? data ends code segment assume cs:code,ds:data begin proc far mov ax,data mov ds,ax mov cx,9 lea si,block mov al,si x1: inc si cmp al,si jae x2 mov al,
5、si x2: loop x1 mov result,al mov ah ,0 mov bx,ax call xianshi mov ah,4ch int 21h begin endp xianshi proc near mov al,80h and al,bl jnz minus jmp disp minus: mov dl,- mov ah,2 int 21h neg bl jmp disp disp: mov cx,100 call dec_div mov cx,10 call dec_div mov cx,1 call dec_div mov ah,4ch int 21h xianshi
6、 endp dec_div proc near mov ax,bx mov dl,0 div cl mov bl,ah mov bh,0 mov dl,al add dl,30h mov ah,2 int 21h ret dec_div endp code ends end begin 4. 求一個數(shù)據(jù)塊 (由 20個單字節(jié)的帶符號數(shù)組成) 中的正數(shù)和(字)和負(fù)數(shù)和(字) ,并在屏幕上用十進制的形式顯示出兩個和。程序如下: data segment block dw -100,100,200,-200,5,6,7,8,9,10 dw 11,12,13,14,15,50,-50,150,-150
7、,-200 posit dw ? negat dw ? st1 db the sum of all the positive numbers:$ st2 db the sum of the negative numbers:$ data ends code segment assume cs:code ,ds:data start proc mov ax,data mov ds,ax mov bx,offset block mov si,0 mov di,0 mov cx,20 x1: mov ax,bx cmp ax,0 jge x3 add di,ax jmp x2 x3: add si,
8、ax x2: add bx,2 loop x1 mov posit,si mov negat,di mov bx,si mov dx,offset st1 mov ah,9 int 21h call xianshi mov dl,0dh mov ah,2 int 21h mov dl,0ah mov ah,2 int 21h mov bx,negat neg bx and bx,7fffh mov dx,offset st2 mov ah,9 int 21h mov dl,- mov ah,2 int 21h call xianshi mov ah,4ch int 21h start endp
9、 xianshi proc near mov cx,100 call dec_div mov cx,10 call dec_div mov cx,1 call dec_div ret xianshi endp dec_div proc near mov ax,bx mov dx,0 div cx mov bx,dx mov dl,al add dl,30h mov ah,2 int 21h ret dec_div endp code ends end start 5. 將寄存器 bx中的二進制數(shù)轉(zhuǎn)換成十六進制數(shù)并在屏幕上顯示出來。程序如下: code segment assume cs:cod
10、e binhex proc far mov ch,4 mov bx,1000 rotate: mov cl,4 rol bx,cl mov dl,bl and dl,0fh add dl,30h cmp dl,3ah jl output add dl,7 output: mov ah,2 int 21h dec ch jne rotate mov dl,h mov ah,2 int 21h mov ah,4ch int 21h binhex endp code ends end binhex實驗三:1. 從鍵盤上輸入一個十進制數(shù)(065535) ,轉(zhuǎn)換成二進制數(shù)并放入寄存器bx中,其程序框圖如
11、下:程序如下: code segment assume cs:code start proc call decbin call xianshi mov ah,4ch int 21h start endp decbin proc near mov cx,10 mov bx,0 lop1: mov ah,1 int 21h cmp al,30h jl exit cmp al,39h jg exit sub al,30h mov ah,00h xchg ax,bx mul cx add bx,ax jmp lop1 exit: ret decbin endp xianshi proc near lp
12、1: mov cx,10000 call dec_div mov cx,1000 call dec_div mov cx,100 call dec_div mov cx,10 call dec_div mov cx,1 call dec_div ret xianshi endp dec_div proc near mov ax,bx mov dx,0 div cx mov bx,dx mov dl,al add dl,30h mov ah,2 int 21h ret dec_div endp code ends end start 2. 從鍵盤上輸入 065535 范圍的一個十進制數(shù),在屏幕上
13、顯示出相應(yīng)的十六進制數(shù)。程序如下: code segment assume cs:code start proc call decbin mov ch,4 call rotate mov ah,4ch int 21h start endp decbin proc near mov cx,10 mov bx,0 lop1: mov ah,1 int 21h cmp al,30h jl exit cmp al,39h jg exit sub al,30h mov ah,00h xchg ax,bx mul cx add bx,ax jmp lop1 exit: ret decbin endp ro
14、tate proc lop2: mov cl,4 rol bx,cl mov dl,bl and dl,0fh add dl,30h cmp dl,3ah jl output add dl,7 output: mov ah,2 int 21h dec ch jne lop2 mov dl,h mov ah,2 int 21h mov ah,4ch int 21h rotate endp code ends end start 實驗四:1. 在內(nèi)存中存有一字符串,以0 為結(jié)尾,程序開始輸出hello 然后等待從鍵盤輸入一字符, 再改字符串中尋找該字符, 若找到,輸出 yes ;若找不到,輸出 n
15、o ,然后再輸入下一字符。程序如下: data segment str1 db hello,0dh,0ah,$ str2 db 20h,yes,0dh,0ah,$ str3 db 20h,no,0dh,0ah,$ str4 db 1 2 3 0 4 5 a b a=! ?,00h data ends code segment assume cs:code,ds:data start proc far mov ax,data mov ds,ax mov dx,offset str1 mov ah,9 int 21h loop1: mov ah,1 int 21h mov bx,offset st
16、r4 gon: mov ah,bx cmp ah,0 jz no inc bx cmp ah,al jnz gon mov dx,offset str2 go: mov ah,9 int 21h jmp loop1 no: mov dx,offset str3 jmp go start endp code ends end start 2. 實驗內(nèi)容1 的程序是個無限循環(huán)程序,若按esc 鍵,讓程序退出循環(huán),是系統(tǒng)返回dos 。已知 esc 鍵的鍵值是1bh ,按照上面要求對實驗內(nèi)容 1 的程序進行修改,然后重新匯編、鏈接和運行。程序如下: data segment str1 db hello,0dh,0ah,$ str2 db 20h,yes,0dh,0ah,$ str3 db 20h,no,0dh,0ah,$ str4 db 1 2 3 0 4 5 a b a=! ?,00h data ends code segment assume cs:code,ds:data start proc far mov a
溫馨提示
- 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)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年裁判員資格考試試題及答案
- 2025年對外漢語教學(xué)專業(yè)考試試題及答案
- 2025年會計實務(wù)基礎(chǔ)知識考試試題及答案
- 生物制藥專利技術(shù)許可與國內(nèi)臨床試驗及注冊申請合同
- 生鮮食品質(zhì)量責(zé)任保險合作協(xié)議
- 金融科技開源軟件貢獻者責(zé)任協(xié)議
- 網(wǎng)紅甜品店品牌合作加盟及全國原料供應(yīng)與物流合同
- 證券公司競業(yè)禁止及經(jīng)濟補償協(xié)議
- 淘寶店鋪多渠道營銷效果分析與整合傳播合同
- 電商店鋪債務(wù)清算與權(quán)益保障合同
- 合肥市2025屆高三年級5月教學(xué)質(zhì)量檢測(合肥三模)歷史試題+答案
- 貨運司機測試題及答案
- 意識形態(tài)單選試題及答案
- 醫(yī)療器械網(wǎng)絡(luò)銷售質(zhì)量管理規(guī)范宣貫培訓(xùn)課件2025年
- 2025年廣東省深圳市中考英語聽說題型專項訓(xùn)練課件(模仿朗讀 回答問題 提問信息)
- 量子通信平臺下的宇宙觀測-全面剖析
- 2025年全國防災(zāi)減災(zāi)日班會 課件
- 遼寧大連公開招聘社區(qū)工作者考試高頻題庫帶答案2025年
- 軟件版本更新與升級維護合同
- 福彩考試題庫目錄及答案
- SL631水利水電工程單元工程施工質(zhì)量驗收標(biāo)準(zhǔn)第1部分:土石方工程
評論
0/150
提交評論