资源描述:
《微机原理-数码转换实验报告.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验九数码转换一、实验目的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
2、,0AHINT21HLEASI,DATA1MOVCL,[SI+1]LEADI,DATA2ADDSI,2CHK:MOVAL,[SI+2]CMPAL,'0'JBL01CMPAL,'9'JAL01SUBAL,30HMOVBL,ALMOV[DI],BLINCSIINCDIDECCXJNZCHKL01:MOVBL,0FFHLOOPCHKMOVAH,4CHINT21HCODEENDSENDSTART2、BCD码转换为二进制码DATASEGMENTBCDDB1,2,3,4,5ADW?DATAENDSSTACKSEGMENTPARASTAC
3、K''STACK''STAPNDW50DUP(?)STACKENDSCODESEGMENTMAINPROCFARASSUMEDS:DATA,CS:CODE,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVAX,STACKMOVSS,AXCALLCONVERTMOVA,BXRETMAINENDPCONVERTPROCNEARPUSHSIPUSHCXPUSHAXMOVSI,4L1:MOVAL,BCD[SI]CBWXCHGAX,BXMOVCX,10DMULCXXCHGAX,BXADDBX,AXDECSIJNZ
4、L1POPAXPOPCXPOPSIEXIT:MOVAH,4CHINT21HCONVERTENDPCODEENDSENDSTART3、十六进制数转换为ASCII码DATASEGMENTDATA1DW2010HDATA2DB4DUP(?)DATAENDSSTACKSSEGMENTPARASTACK'STACK'STACKSENDSCODESSEGMENTASSUMESS:STACKS,CS:CODESASSUMEDS:DATASSTART:MOVAX,DATAMOVDS,AXLEASI,DATA1MOVAX,[SI]MOVCL,
5、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,
6、0AHJCLPADDBL,07HLP:ADDBL,30HRETASCENDPXSPROCMOVDL,BLMOVAH,02HINT21HRETXSENDPCODEENDSENDSTART4、六进制数转换为十进制DATASSEGMENTSTRING1DB0DH,0AH,'$'STRING2DB0DH,0AH,'$'DATASENDSSTACKSSEGMENTSTACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AXMOVDX,O
7、FFSETSTRING1MOVAH,9INT21HMOVCL,10HMOVBX,0NEWCHAR:MOVAH,1INT21HSUBAL,30HJBDISPCBWXCHGAX,BXMOVCH,0MULCXXCHGAX,BXADDBX,AXJNCNEWCHARDISP:MOVDX,OFFSETSTRING2MOVAH,9INT21HMOVCX,10000AGAIN:MOVDX,0MOVAX,BXDIVCXMOVBX,DXMOVDL,ALADDDL,30HCMPDL,39HJLENEXTADDDL,7HNEXT:MOVAH,2IN
8、T21HMOVDX,0MOVAX,CXMOVCX,10DIVCXMOVCX,AXCMPCX,0JNZAGAINMOVAH,4CHINT21HCODESENDSENDSTART5、十进制转换成七段码DATASEGMENTDATA1DB3,4TABLEDB23H,56H,42H,75H,00H