云南大学-软件学院--汇编实验5.doc_第1页
云南大学-软件学院--汇编实验5.doc_第2页
云南大学-软件学院--汇编实验5.doc_第3页
云南大学-软件学院--汇编实验5.doc_第4页
云南大学-软件学院--汇编实验5.doc_第5页
免费预览已结束,剩余8页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

计算机组成原理与汇编元程序设计实验报告实验五 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 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!,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 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,offset 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,siand 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 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 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 dl,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 proclea 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 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 bh,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,0or bx,dxcmp ch,1jz Rmov cl,4rol bx,clR:inc didec chjnz u2xor si,sis1:cmp bx,1000jc s2sub bx,1000inc sijmp s1s2:mov dx,siand dx,0fhadd dl,30hmov ah,2int 21hxor si,sis3:cmp bx,100jc s4

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论