您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 电子设计/PCB > 微机原理-数码转换实验报告
实验九数码转换一、实验目的1、掌握计算机常用数据编码之间的相互转换方法。2、进一步熟悉DEBUG软件的使用方法。二、实验内容1、ACSII码转换为非压缩型BCD码2、BCD码转换为二进制码3、十六进制数转换为ASCII码三、实验1、ACSII码转换为非压缩型BCD码DATASEGMENTPARA'DATA'DATA1DB8DUP(?)DATA2DB8DUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,SEGDATA1MOVDS,AXMOVDX,DATAMOVAH,0AHINT21HLEASI,DATA1MOVCL,[SI+1]LEADI,DATA2ADDSI,2CHK:MOVAL,[SI+2]CMPAL,'0'JBL01CMPAL,'9'JAL01SUBAL,30HMOVBL,ALMOV[DI],BLINCSIINCDIDECCXJNZCHKL01:MOVBL,0FFHLOOPCHKMOVAH,4CHINT21HCODEENDSENDSTART利用0AH号功能实现从键盘输入一串十进制数AL=’0’?AL’9’?AL-30H-ALAL-BL保存结果至DATA2INCSI,DIDECCX循环结束?开始结束AL-[SI+2]2、BCD码转换为二进制码DATASEGMENTBCDDB1,2,3,4,5ADW?DATAENDSSTACKSEGMENTPARASTACK''STACK''STAPNDW50DUP(?)STACKENDSCODESEGMENTMAINPROCFARASSUMEDS:DATA,CS:CODE,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVAX,STACKMOVSS,AXCALLCONVERTMOVA,BXRETMAINENDPCONVERTPROCNEARPUSHSIPUSHCXPUSHAXMOVSI,4L1:MOVAL,BCD[SI]CBWXCHGAX,BXMOVCX,10DMULCXXCHGAX,BXADDBX,AXDECSIJNZL1POPAXPOPCXPOPSIEXIT:MOVAH,4CHINT21HCONVERTENDPCODEENDSENDSTART开始将DATA1分离为千、百、十、个位数存于四个连续子单元中,首地址为DATA3循环次数3-CX千位数DATA3-AX调乘10子程序ADDDATA3,2AX+DATA3-AX循环结束保存结果至DATA2加上个位结束乘10子程序AX左移1位AX-BXAX左移1位AX左移1位AX+BX-AX结束否是3、十六进制数转换为ASCII码DATASEGMENTDATA1DW2010HDATA2DB4DUP(?)DATAENDSSTACKSSEGMENTPARASTACK'STACK'STACKSENDSCODESSEGMENTASSUMESS:STACKS,CS:CODESASSUMEDS:DATASSTART:MOVAX,DATAMOVDS,AXLEASI,DATA1MOVAX,[SI]MOVCL,12SHRAX,CLMOVBL,ALCALLASCMOVDATA2,BLCALLXSMOVAX,[SI]MOVCL,8SHRAX,CLANDAX,000FHMOVBL,ALCALLASCMOVDATA2+1,BLCALLXSMOVAX,[SI]MOVCL,4SHRAX,CLANDAX,000FHMOVBL,ALCALLASCMOVDATA2+2,BLCALLXSMOVAX,[SI]ANDAX,000FHMOVBL,ALCALLASCMOVDATA2+3,BLCALLXSMOVAH,4CHINT21HASCPROCCMPBL,0AHJCLPADDBL,07HLP:ADDBL,30HRETASCENDPXSPROCMOVDL,BLMOVAH,02HINT21HRETXSENDPCODEENDSENDSTART分离高位调子程序调显示子程序子程序BL0AH?BL-BL+30HBL-BL+37H结束送显子程序DL-BL显示字符开始去掉最高位结束4、六进制数转换为十进制DATASSEGMENTSTRING1DB0DH,0AH,'$'STRING2DB0DH,0AH,'$'DATASENDSSTACKSSEGMENTSTACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AXMOVDX,OFFSETSTRING1MOVAH,9INT21HMOVCL,10HMOVBX,0NEWCHAR:MOVAH,1INT21HSUBAL,30HJBDISPCBWXCHGAX,BXMOVCH,0MULCXXCHGAX,BXADDBX,AXJNCNEWCHARDISP:MOVDX,OFFSETSTRING2MOVAH,9INT21HMOVCX,10000AGAIN:MOVDX,0MOVAX,BXDIVCXMOVBX,DXMOVDL,ALADDDL,30HCMPDL,39HJLENEXTADDDL,7HNEXT:MOVAH,2INT21HMOVDX,0MOVAX,CXMOVCX,10DIVCXMOVCX,AXCMPCX,0JNZAGAINMOVAH,4CHINT21HCODESENDSENDSTART分离高位转换显示开始结束5、十进制转换成七段码DATASEGMENTDATA1DB3,4TABLEDB23H,56H,42H,75H,00H,24H,67H,39H,20HDATA2DB2DUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATAST:MOVDI,OFFSETBUFDAMOVCL,80HMOVBX,OFFSETTABLEDISI:MOVBL,[DI+0]MOVAX,BXXLATMOVDX,PORTSEGOUTDX,ALMOVAL,CLMOVDX,PORTBITOUTDX,ALPUSHCXMOVCX,30HDELAY:LOOPDELAYPOPCXCMPCL,20HJZQUITINCDISHRCL,1JMPDISIQUITCODEENDSENDST
本文标题:微机原理-数码转换实验报告
链接地址:https://www.777doc.com/doc-7303124 .html