




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、實(shí)驗(yàn)一:輸出字符 a的源程序如下:prog segment assume cs:prog start: mov dl,a mov ah , 2 int 21h mov ah , 4ch int 21h prog ends end start 實(shí)驗(yàn)二:1. 把 bx中的二進(jìn)制數(shù)轉(zhuǎn)換成十進(jìn)制數(shù),在屏幕上顯示出來,只考慮無符號(hào)數(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中的帶符號(hào)數(shù)轉(zhuǎn)換成十進(jì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. 求一個(gè)數(shù)據(jù)塊(由10 個(gè)單字節(jié)的無符號(hào)數(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. 求一個(gè)數(shù)據(jù)塊 (由 20個(gè)單字節(jié)的帶符號(hào)數(shù)組成) 中的正數(shù)和(字)和負(fù)數(shù)和(字) ,并在屏幕上用十進(jìn)制的形式顯示出兩個(gè)和。程序如下: 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中的二進(jìn)制數(shù)轉(zhuǎn)換成十六進(jì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實(shí)驗(yàn)三:1. 從鍵盤上輸入一個(gè)十進(jìn)制數(shù)(065535) ,轉(zhuǎn)換成二進(jì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 范圍的一個(gè)十進(jìn)制數(shù),在屏幕上
13、顯示出相應(yīng)的十六進(jìn)制數(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 實(shí)驗(yàn)四: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. 實(shí)驗(yàn)內(nèi)容1 的程序是個(gè)無限循環(huán)程序,若按esc 鍵,讓程序退出循環(huán),是系統(tǒng)返回dos 。已知 esc 鍵的鍵值是1bh ,按照上面要求對(duì)實(shí)驗(yàn)內(nèi)容 1 的程序進(jìn)行修改,然后重新匯編、鏈接和運(yùn)行。程序如下: 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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 人教版五年級(jí)下冊(cè)分?jǐn)?shù)加減法簡(jiǎn)便計(jì)算練習(xí)200道及答案
- 2025年證券從業(yè)資格證考試學(xué)習(xí)攻略試題及答案
- 項(xiàng)目管理考試內(nèi)容分析的深入思考與總結(jié)試題及答案
- 項(xiàng)目實(shí)施中的信息流暢溝通探索試題及答案
- 項(xiàng)目管理中的決策考題及答案
- 證券從業(yè)資格證行業(yè)分析考題及答案
- 探討證券從業(yè)資格證考試的法律條款試題及答案
- 2025年理財(cái)師考試復(fù)習(xí)技巧試題及答案
- 2025年證券從業(yè)資格證考試多維度分析試題及答案
- 靈活工作模式下的工作計(jì)劃設(shè)計(jì)
- 防溺水工作布置教師會(huì)議上校長(zhǎng)講話:全力防溺水守護(hù)學(xué)生生命“生命線”
- 湖南省永州市祁陽市茅竹鎮(zhèn)中心學(xué)校2024-2025學(xué)年下學(xué)期期中監(jiān)測(cè)八年級(jí)下冊(cè)《物理》試卷(含答案)
- GB/T 26354-2025旅游信息咨詢服務(wù)
- SL631水利水電工程單元工程施工質(zhì)量驗(yàn)收標(biāo)準(zhǔn)第1部分:土石方工程
- 情緒的管理課件
- 2025年中國(guó)工業(yè)X射線檢測(cè)設(shè)備行業(yè)市場(chǎng)集中度、企業(yè)競(jìng)爭(zhēng)格局分析報(bào)告-智研咨詢發(fā)布
- 重難點(diǎn)05 涉及二次函數(shù)的圖形變化類問題與二次函數(shù)有關(guān)的創(chuàng)新類問題(2種命題預(yù)測(cè)+77種題型匯-總+專題訓(xùn)練+3種解題方法)(解析版)
- 江蘇省外國(guó)語學(xué)校2024-2025學(xué)年度高二下學(xué)期期中考試歷史試題
- 職工維權(quán)知識(shí)培訓(xùn)課件
- 第15課《青春之光》課件-2024-2025學(xué)年統(tǒng)編版語文七年級(jí)下冊(cè)
- 2025年國(guó)家國(guó)防科技工業(yè)局軍工項(xiàng)目審核中心招聘筆試參考題庫(kù)附帶答案詳解
評(píng)論
0/150
提交評(píng)論