云南大学-软件学院--汇编实验5

上传人:F****n 文档编号:98263093 上传时间:2019-09-09 格式:DOC 页数:13 大小:165KB
返回 下载 相关 举报
云南大学-软件学院--汇编实验5_第1页
第1页 / 共13页
云南大学-软件学院--汇编实验5_第2页
第2页 / 共13页
云南大学-软件学院--汇编实验5_第3页
第3页 / 共13页
云南大学-软件学院--汇编实验5_第4页
第4页 / 共13页
云南大学-软件学院--汇编实验5_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《云南大学-软件学院--汇编实验5》由会员分享,可在线阅读,更多相关《云南大学-软件学院--汇编实验5(13页珍藏版)》请在金锄头文库上搜索。

1、计算机组成原理与汇编元程序设计实验报告实验五 80x86分支,循环,子程序,宏程序设计 姓名: 学号: 序号: 班级: 分数:1编写设计一个2,10,16进制的码制转换程序,要求:程序有友好的运行界面;输入任意类型进制的数据,转换为其余两种进制类型;要求程序有方便的输入输出功能;要求程序能够处理基本的错误信息;程序的基本结构采用子程序结构;源程序:.8086.model small.data str db 0ah,0dh,please input 1 to 8 to choise the function,0ah,0dh db 1.btd,0ah,0dh db 2.bth,0ah,0dh db

2、 3.dth,0ah,0dh db 4.dtb,0ah,0dh db 5.htb,0ah,0dh db 6.htd,0ah,0dh db 7.again,0ah,0dh db 8.end,0ah,0dh,$ b db Please input a Binary number,0ah,0dh,$ d db Please input a decimal number,0ah,0dh,$ h db Please input a Hexadecimal number,0ah,0dh,$ agai db Please input again,0ah,0dh,$ wr db A wrong number!

3、,0ah,0dh,$ num db 6,?,6 dup (?) num1 db 16,?,16 dup (?).codestart:mov ax,datamov ds,axchoice:lea dx,strmov ah,9int 21hmov ah,1int 21hjmp C1again:mov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hjmp choiceMo:mov dx,offset agaimov ah,9int 21hjmp choiceC1:cmp al,1jnz C2call btdjmp againC2:cmp al,2jnz

4、C3call bthjmp againC3:cmp al,3jnz C4call dthjmp againC4:cmp al,4jnz C5call dtbjmp againC5:cmp al,5jnz C6call htbjmp againC6:cmp al,6jnz C7call htdjmp againC7:cmp al,7jnz C8jmp MoC8:cmp al,8jnz wrongen:mov ah,4chint 21hwrong:lea dx,wrmov ah,9int 21hjmp Mobtd procmov dx,offset bmov ah,9int 21hmov dx,o

5、ffset num1mov ah,0ahint 21hmov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hmov di,offset num1mov ch,di+1zq2:mov dl,di+2cmp dl,39hjg zqsub dl,30hjmp zq1zq:sub dl,37hzq1:mov dh,0or bx,dxcmp ch,1jz zq3rol bx,1zq3:inc didec chjnz zq2xor si,sijj1:cmp bx,10000jc jjsub bx,10000inc sijmp jj1jj:mov dx,sian

6、d dx,0fhadd dl,30hmov ah,2int 21hxor si,siL1:cmp bx,1000jc L2sub bx,1000inc sijmp L1L2:mov dx,siand dx,0fhadd dl,30hmov ah,2int 21hxor si,siL3:cmp bx,100jc L4sub bx,100inc sijmp L3L4:mov dx,siand dx,0fhadd dl,30hmov ah,2int 21hxor si,siL5:cmp bx,10jc L6sub bx,10inc sijmp L5L6:mov dx,siand dx,0fhadd

7、dl,30hmov ah,2int 21hxor dx,dxmov dx,bxand dx,0fhadd dl,30hmov ah,2int 21hretbtd endpbth procmov dx,offset bmov ah,9int 21h mov dx,offset num1mov ah,0ahint 21hmov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hmov di,offset num1mov ch,di+1K1:mov al,di+2sub al,30hor bl,alrol bx,1inc didec chjnz K1ror

8、bx,1mov ch,4mov cl,4K4:rol bx,clmov dl,bland dl,0fhcmp dl,9jg K2add dl,30hjmp K3K2:add dl,37hK3:mov ah,2int 21hdec chjnz K4retbth endpdth proclea dx,dmov ah,9int 21h mov dx,offset nummov ah,0ahint 21hmov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hmov di,offset nummov cl,di+1add di,2mov dl,disub d

9、l,30hmov al,10mul dlmov ch,0dec cxI:inc dimov dl,disub dl,30hmov dh,0add ax,dxcmp cx,1jz I1mov bx,axmov ax,10mul bxI1:loop Imov bx,axmov si,offset nummov ch,si+1inc chinc chmov cl,4O:rol bx,clmov dl,bland dl,0fhcmp dl,9jg MMadd dl,30hjmp PPMM:add dl,37hPP:mov ah,2int 21hdec chjnz Oretdth endpdtb pro

10、clea dx,dmov ah,9int 21hmov dx,offset nummov ah,0ahint 21hmov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hmov di,offset nummov cl,di+1add di,2mov dl,disub dl,30hmov al,10mul dlmov ch,0dec cxc:inc dimov dl,disub dl,30hmov dh,0add ax,dxcmp cx,1jz ccmov bx,10mul bxmov bx,axcc:dec cxjnz cmov bx,axmov

11、cx,16x:rol bx,1mov dl,bland dl,01hadd dl,30hmov ah,2int 21hloop xretdtb endphtb procmov dx,offset hmov ah,9int 21hmov dx,offset nummov ah,0ahint 21hmov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hmov di,offset nummov ch,di+1Z1:mov bl,di+2cmp bl,39hjg ZZsub bl,30hjmp ZXZZ:sub bl,37hZX:mov cl,4mov b

12、h,4shl bl,clZ:rol bl,1mov dl,bland dl,01hadd dl,30hY:mov ah,2int 21hdec bhjnz Zinc didec chjnz Z1rethtb endphtd procmov dx,offset hmov ah,9int 21hmov dx,offset nummov ah,0ahint 21hmov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hmov di,offset nummov ch,di+1u2:mov dl,di+2cmp dl,39hjg usub dl,30hjmp u1u:sub dl,37hu1:mov dh,0

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 教学/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号