版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、匯編語言程序設(shè)計(jì)實(shí)驗(yàn)報(bào)告 (二)班級:軟 093 班 學(xué)號:0姓名:江 濤指導(dǎo)老師:陸勤2011年 11 月是否等于1000是否不小于60是否不小于90是否不小于80是否不小于70DI是否 為0CI加1實(shí)驗(yàn)一統(tǒng)計(jì)不同成績段學(xué)生的人數(shù)1、程序流程圖:設(shè)置10個(gè)學(xué)生成績運(yùn)行結(jié)束Ch加1BI加1Dh加1Bh加1AI加12、源代碼:datas segmentarray db 67,69,84,90,73,88,99,63,100,80 string1 db The number of 100:$ string2 db The number of 90-99:$ string3 db The numbe
2、r of 80-89:$ string4 db The number of 70-79:$ string5 db The number of 60-69:$ string6 db the number of low 60:$ datas endsstacks segmentstacks endscodes segmentassume cs:codes,ds:datas,ss:stacks start:mov ax,datasmov ds,axmov al,0 ; 用于計(jì)數(shù)mov bx,0mov cx,0mov dh,0mov dl,10 ; 循環(huán)次數(shù)call countcall outputm
3、ov ah,4chint 21h count proc near ;mov si,0next:cmp arraysi,100 ; jz L1 jl next1 next1:cmp arraysi,90 ;jae L2jl next2子程序一,用來統(tǒng)計(jì)各分?jǐn)?shù)段的人數(shù)將分?jǐn)?shù)與 100 比較與 90 比較next2:cmp arraysi,80 ; jae L3 jl next3與 80 比較next3:cmp arraysi,70 ; jae L4 jl next4與 70 比較next4:cmp arraysi,60 ; jae L5與 60 比較inc dh inc sidec dl;jnz
4、next;jmp exit;循環(huán)次數(shù)減 1若 dl 尚未減少到零則回到 next 處執(zhí)行 若為零就轉(zhuǎn)到 exit 處執(zhí)行,退出L1:inc al;inc sidec dl對分?jǐn)?shù)為 100 的學(xué)生的人進(jìn)行計(jì)數(shù)jnz nextjmp exit L2:inc bh;inc si dec dl對分?jǐn)?shù)在 90-99 的學(xué)生的人進(jìn)行計(jì)數(shù)jnz nextjmp exit L3:inc bl;inc si dec dl對分?jǐn)?shù)在 80-89 的學(xué)生的人進(jìn)行計(jì)數(shù)jnz nextjmp exit L4:inc ch;inc si對分?jǐn)?shù)在 70-79 的學(xué)生的人進(jìn)行計(jì)數(shù)dec dljnz nextjmp exit L
5、5:inc cl;inc si dec dl對分?jǐn)?shù)在 60-69 的學(xué)生的人進(jìn)行計(jì)數(shù)jnz next exit:retcount endp output proc near;子程序二,用來輸出相關(guān)內(nèi)容mov ah,0push dxpush cxpush bxpush ax lea dx,string1;mov ah,9輸出 100 分的人數(shù)int 21H pop bx mov dl,bl add dl,30h mov ah,2int 21Hcall enter lea dx,string2;mov ah,9輸出 90至 99分的人數(shù)int 21H pop bx mov dl,bh add dl
6、,30h mov ah,2int 21Hcall enter lea dx,string3;mov ah,9輸出 80至 89分的人數(shù)int 21H mov dl,bl add dl,30h mov ah,2int 21Hcall enter lea dx,string4;輸出 70至 79分的人數(shù)mov ah,9int 21Hpop bxmov dl,bhadd dl,30hmov ah,2int 21Hcall enterlea dx,string5 ; 輸出 60 至 69 分的人數(shù)mov ah,9int 21Hmov dl,bladd dl,30hmov ah,2int 21Hcall
7、 enterlea dx,string6 ; 輸出低于 60 分的人數(shù)mov ah,9int 21Hpop bxmov dl,bhadd dl,30hmov ah,2int 21Hcall enterretoutput endpenter proc near ; 子程序三,用來在每行輸出后回車換行 mov dl,0ah mov ah,02h int 21h mov dl,0dh mov ah,02h int 21h retenter endpcodes endsend start3、調(diào)試:補(bǔ)充實(shí)驗(yàn)一編制一個(gè)程序,要求在鍵盤上接收一個(gè) 4位的 16 進(jìn)制數(shù),并在屏幕 上顯示與它等值的二進(jìn)制數(shù)1、
8、源代碼:data segmentstring1 db please input:$ ;提示輸入string2 db 16 dup(?),$data endscode segmentassume cs:code,ds:datamain proc farstart:mov ax,datamov ds,ax lea di,string2 xor bx,bx mov ch,4 lea dx,string1 mov ah,9 int 21h l1:mov ah,1 int 21hcmp al,0 ; jb l1小于 0 的 ascii 跳到 l1cmp al,9 ;jbe l3不小于 9 的 ascii
9、 跳到 l3cmp al,A ; jb l1小于A的ascii跳到11cmp al,F ; jbe l2不小于 F 的 ascii 跳到 l2cmp al,a ; jb l1小于 a 的 ascii 跳到 l1cmp al,f ; ja l1大于 f 的 ascii 跳到 l1sub al,20h ;l2:sub al,37hjmp l4字母轉(zhuǎn)換為表示的十進(jìn)制數(shù)l3: ;16and al,0fh進(jìn)制數(shù)轉(zhuǎn)換為 2 進(jìn)制數(shù)l4:mov cl,4 shl bx,cl add bl,al dec ch轉(zhuǎn)換得到的 2進(jìn)制數(shù)存入寄存器 bx 中jnz l1mov cx,16 l5:xor dl,dl ro
10、l bx,1 rcl dl,1 add dl,30h mov di,dl inc di loop l5輸出得到的 2 進(jìn)制數(shù)mov dl,0dhmov ah,2 int 21h mov dl,0ahmov ah,2 int 21h回車換行l(wèi)ea dx,string2 mov ah,9 int 21hmov ah,4ch int 21h main endp code endsend start2、調(diào)試:補(bǔ)充實(shí)驗(yàn)二從鍵盤輸入一系列字符串(以回車符結(jié)束) ,按字母、數(shù)字和其他字符分類計(jì)數(shù),最后顯示出這三類的計(jì)數(shù)結(jié)果1、源代碼:輸入提示data segmentstring0 db please inp
11、ut:$ ;string1 db the number of letter:,$ string2 db the number of num:,$ string3 db the number of others:,$ data ends code segmentassume cs:code,ds:data main proc far start:mov ax,data mov ds,ax lea dx,string0 mov ah,9 int 21h xor cx,cx xor bl,bll0: ; 數(shù)字字符計(jì)數(shù) mov ah,1int 21h cmp al,0dh jz l4 cmp al,0
12、 jb l3 cmp al,9 ja l1 inc ch jmp l0l1: ; 大寫字母計(jì)數(shù) cmp al,A jb l3 cmp al,Z ja l2 inc cl jmp l0l2: ; 小寫字母計(jì)數(shù) cmp al,a jb l3cmp al,z ja l3 inc cl jmp l0l3: ; 其它字符計(jì)數(shù) inc bl jmp l0l4:lea dx,string1 ; 輸出字母個(gè)數(shù) mov ah,9 int 21h mov dl,cl or dl,30h mov ah,2 int 21h mov dl,0dh mov ah,2 int 21h mov dl,0ah mov ah,2
13、 int 21hlea dx,string2 ; 輸出數(shù)字個(gè)數(shù) mov ah,9 int 21h mov dl,ch or dl,30h mov ah,2 int 21h mov dl,0dh mov ah,2 int 21h mov dl,0ah mov ah,2 int 21hlea dx,string3 ; 輸出其它字符個(gè)數(shù) mov ah,9 int 21h mov dl,bl or dl,30h mov ah,2 int 21h mov dl,0dhmov ah,2 int 21h mov dl,0ah mov ah,2 int 21hmov ah,4ch int 21hmain en
14、dp code endsend start2、調(diào)試:補(bǔ)充實(shí)驗(yàn)三根據(jù)鍵盤輸入的字符AE(或ae),分別顯示ONE、TWO、THREE、FOUR、FIVE,當(dāng)輸入其他字符時(shí),顯示ERROR,然后重新輸入1、源代碼:data segmentstring0 db please input:$ ;mess db 0ah,0dh,ONE ,$ db 0ah,0dh,TWO ,$ db 0ah,0dh,THREE,$ db 0ah,0dh,FOUR ,$ db 0ah,0dh,FIVE ,$err db 0ah,0dh,Error,0ah,0dh,$ data ends code segmentassume cs:code,ds:datamain proc farstart:mov ax,datamov ds,axlea dx,string0mov ah,9int 21h提示輸入mov ah,1; 輸入字母int 21h cmp al,A jb error cmp al,E ja compare sub al,65 jmp print輸入字母 ascii 值小于 A 的報(bào)錯(cuò)輸入字母ascii值大于E的跳的compare處 輸入的是小寫字母 a-ecompare: cmp al,a jb error cmp al,e ja er
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度人工智能產(chǎn)業(yè)投資轉(zhuǎn)借款合作協(xié)議模板3篇
- 國防建設(shè)知識
- 二零二五年度個(gè)人知識產(chǎn)權(quán)侵權(quán)糾紛授權(quán)委托書3篇
- 二零二五年度商場消防安全責(zé)任協(xié)議書3篇
- 二零二五年度城市停車場信息化建設(shè)承包協(xié)議3篇
- 二零二五年辦公樓智能安防與保潔服務(wù)合同3篇
- 二零二五版海洋石油鉆井平臺外派海員聘用合同范本3篇
- 二零二五年度商品房團(tuán)購項(xiàng)目合作代理協(xié)議3篇
- 二零二五年度高校研究生學(xué)術(shù)交流活動(dòng)合作協(xié)議3篇
- 藝術(shù)地坪施工方案
- 4.1中國特色社會(huì)主義進(jìn)入新時(shí)代+課件-2024-2025學(xué)年高中政治統(tǒng)編版必修一中國特色社會(huì)主義
- 班級建設(shè)方案中等職業(yè)學(xué)校班主任能力大賽
- T-TJSG 001-2024 天津市社會(huì)組織社會(huì)工作專業(yè)人員薪酬指導(dǎo)方案
- 人教版九上化學(xué)第二單元課題2氧氣課件
- 中頻治療儀的使用流程
- 梁湘潤《子平基礎(chǔ)概要》簡體版
- 圖形的位似課件
- 調(diào)料廠工作管理制度
- 人教版《道德與法治》四年級下冊教材簡要分析課件
- 2023年MRI技術(shù)操作規(guī)范
- 辦公用品、易耗品供貨服務(wù)方案
評論
0/150
提交評論