资源描述:
《汇编程序:求两个正整数的最大公约数》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、CRLFMACROMOVAH,02HMOVDL,0DHINT21HMOVAH,02HMOVDL,0AHINT21HENDMdatasegmentMdw8NDW16resultdw0ydw10output1dw0Kdw0s1db"Pleaseinputanumberas'M':$"s2db"Pleaseinputanumberas'N':$"s3db"Theresultis:$"dataendsstacksegmentsdw1000dup(?)stackendscodesegmentassumecs:code,ds:data,ss:stackstart:pushdsmovax,0pushaxmo
2、vax,datamovds,axleadx,s1movah,09hint21hcallintputmovax,KmovM,axmovK,0crlfleadx,s2movah,09hint21hcallintputmovax,KmovN,axmovK,0crlfcalloujimovax,resultmovoutput1,axleadx,s3movah,09hint21hcalloutputmovoutput1,0retoujiprocnearxordx,dxmovax,mmovbx,nT:cmpax,bxjgeUxchgax,bxU:movcx,axdivbxcmpdx,0jnzGmovres
3、ult,bxjmpNEXTG:movax,dxxordx,dxjmpTNEXT:retoujiendpintputprocnearin_1:movah,01hint21hxorah,ahcmpax,0dhjein_outcmpax,30hjbin_outcmpax,39hjGin_outsubax,30hmovdi,axmovax,KmulymovK,axaddK,diloopin_1in_out:retintputendpoutputprocnearmovax,output1xordx,dxmovdi,0p1:divypushdxincdixordx,dxcmpax,10jboutput_n
4、1jmpp1output_n1:cmpax,0jzoutput_n2pushaxincdioutput_n2:movcx,dip2:popdxadddx,30hmovah,02hint21hloopp2movah,4chint21houtputendpcodeendsendstart