资源描述:
《第3章习题答案教学文案.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、__________________________________________________3-11.AX=0048H,AX=0702H2.AX=0059H,AX=0411H,AX=0107H,DL=04H3.AX=0011H,AX=0107H4.AX=005AH,AX=0900H,AX=0908H5.AL=62H6.AX=0248H3-2stacksegmentstack¢stack¢dw32dup(0)stackendsdatasegmentBVARDB99Hdataendscodesegmentbeginprocfara
2、ssumess:stack,cs:code,ds:datapushdssubax,axpushaxmovax,datamovds,axMOVAL,BVARMOVCL,4SHRAL,CLMOVAH,10MULAHANDBVAR,0FHADDBVAR,ALret____________________________________________________________________________________________________beginendpcodeendsendbegin先将2位压缩BCD数转换为非压缩
3、BCD数,再用AAD指令将非压缩BCD数转换为二进制数:MOVAL,BVARMOVAH,ALMOVCL,4SHRAH,CLANDAL,0FHAADMOVBVAR,AL3-3stacksegmentstack¢stack¢dw32dup(0)stackendsdatasegmentW1DW0807HW2DW0609HB3DB2DUP(0)dataendscodesegmentbeginprocfarassumess:stack,cs:code,ds:datapushdssubax,axpushaxmovax,datamovds,axM
4、OVAX,W1;AX=0807HSUBAL,BYTEPTRW2;AL=FEH,CF=1AAS;AL=08H,AH=07HMOVB3,ALMOVAL,AHSUBAL,W2+1MOVB3+1,ALretbeginendpcodeendsendbegin还可以用AAD指令将两个非压缩BCD数转换为二进制数,相减后再用AAM将差转换为非压缩BCD数:MOVAX,W2AADMOVDX,AXMOVAX,W1_______________________________________________________________________
5、_____________________________AADSUBAX,DXAAMMOVBYTEPTRB3,AX3-4stacksegmentstack¢stack¢dw32dup(0)stackendsdatasegmentD1DD06070809HD2DD04050607HOBFDB6DUP(0)dataendscodesegmentbeginprocfarassumess:stack,cs:code,ds:datapushdssubax,axpushaxmovax,datamovds,axMOVSI,0MOVDI,OFFSE
6、TOBF+5MOVBYTEPTR[DI],¢$¢MOVCX,4XORAH,AHAGAIN:MOVAL,BYTEPTRD1[SI]ADDAL,BYTEPTRD2[SI]ADDAL,AHMOVAH,0AAAADDAL,30HDECDIMOV[DI],ALINCSILOOPAGAINANDAH,AHJZN5DECDIMOVBYTEPTR[DI],¢1¢N5:MOVDX,DIMOVAH,9INT21Hretbeginendpcodeendsendbegin3-5stacksegmentstack¢stack¢dw32dup(0)_______
7、_____________________________________________________________________________________________stackendsdatasegmentW1DW8931HW2DW5678HOBFDB6DUP(0)dataendscodesegmentbeginprocfarassumess:stack,cs:code,ds:datapushdssubax,axpushaxmovax,datamovds,axMOVDI,0MOVAL,BYTEPTRW1;AL=31
8、HADDAL,BYTEPTRW2;AL=A9H,CF=0,AF=0DAA;AL=09H,CF=1MOVAH,ALMOVAL,BYTEPTRW1+1;AL=89HADCAL,BYTEPTRW2+1;AL=E0H,CF=0,