资源描述:
《汇编程序汇总.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、设平面上一点p的直角坐标为(x,y),x,y为字符号数,试编制若P落在第i象限内,则令k=i;若P落在坐标轴上,则令k=0的程序。stacksegmentstack'stack'dw32dup(0)stackendsdatasegmentxdw0ydw30kdb0dataendscodesegmentbeginprocfarassumess:stack,cs:code,ds:datapushdssubax,axpushaxmovax,datamovds,axmovax,xjzx0y0movax,yjzx0y0
2、movax,xjsx1movax,yjsy1movk,1jmpenddy1:movk,4jmpenddx1:movax,yjsy2movk,2jmpenddy2:movk,3jmpenddx0y0:movk,0jmpenddendd:movdl,kadddl,30hmovah,2int21hretbeginendpcodeendsendbegin编写程序,将字节变量BVAR中的无符号二进制数(0~0FFH)转换为BCD数,在屏幕上显示结果。stacksegmentstack‘stack’ dw32du
3、p(0)stackendsdatasegmentBVARDB99HOBUFDB4DUP(0)dataendscodesegmentbeginprocfar assumess:stack,cs:code,ds:data pushds subax,ax pushax movax,data movds,ax MOVAL,BVAR MOVAH,0 MOVDL,100 DIVDL ADDAL,30H Movobuf,al
4、 MOVAL,AH AAM ADDAX,3030H MOVOBUF+1,AH MOVOBUF+2,AL MOVOBUF+3,‘$’ MOVDXOFFSETOBUF MOVAH,9 INT21H retbeginendpcodeendsendbegin1.编写源程序实现以下功能:z=
5、x-y
6、。x、y、z均为字节变量。stacksegmentstack'stack'dw32dup(0)stackendsdatasegmentxdb12h
7、ydb10hzdb0dataendscodesegmentbeginprocfarassumess:stack,cs:code,ds:datapushdssubax,axpushaxmovax,datamovds,axmoval,xcmpal,yjgea1suby,almovah,ymovz,ahjmpexita1:subal,ymovz,alexit:retbeginendpcodeends编写源程序实现以下功能,在显示器上显示:Enterthestring:IamaChineseOutputthestri
8、ngagain:IamaChinesestacksegmentstack'stack'dw32dup(0)stackendsdatasegmentOBUFDB'Enterthestring:$'IBUFDB0FFH,0,255DUP(0)OBUF1dB'Outputthestringagain:$'dataendscodesegmentbeginprocfarassumess:stack,cs:code,ds:datapushdssubax,axpushaxmovax,datamovds,axMOVDX,OF
9、FSETOBUFMOVAH,9INT21Hmovdl,0ahmovah,2int21hmovdl,0dhmovah,2int21hMOVDX,OFFSETIBUFMOVAH,10INT21Hmovdl,0ahmovah,2int21hmovdl,0dhmovah,2int21hMOVDX,OFFSETOBUF1MOVAH,9INT21Hmovdl,0ahmovah,2int21hmovdl,0dhmovah,2int21hmovbl,ibuf+1movbh,0MOViBUF[BX+2],'$'MOVDX,OF
10、FSETibuf+2MOVAH,9INT21HRETbeginendpcodeendsendbegin编写源程序实现以下功能:将字节变量BVAR中存放的两位压缩BCD数转换为二进制数,并存入原字节变量中。程序运行后,如何查看字节变量BVAR中存放的内容? 1.stacksegmentstack'stack'dw32dup(0)stackendsdatasegmentsttDB10,0,10dup(0