第2次汇编作业键盘输入两个十进制非符号数(≤65535),计算两数之乘积,分别以十进制、十六进制、二进制输出结果。例如:输入:1234565535输出:12345*65535=8090295753038CFC7h00110000001110001100111111000111B其中输入一行字符串可以通过调用int21h的0Ah子功能实现,具体可参考教材P.216。另外,程序中允许使用32位寄存器。CopyrightAsonememberofInformationScienceandElectronicEngineeringInstituteofZhejiangUniversity,Isincerelyhopethiswillenableyoutoacquiremoretimetodowhateveryoulikeinsteadofstrugglingonuselesshomework.Allthecontentyoucanuseasyoulike.Iwishyouwillhaveameaningfuljourneyonyourcollegelife.——Wzh警告:如果用于课堂作业,请尽量自己完成,以防止代码查重!;==================================;codedbyWzh;12345*65535=浙江大学汇编;==================================.386datasegmentuse16bufdb24,0,24dup(?)bufadb24,0,24dup(?)numAdw0numBdw0sdb40dup('')s1db20dup('')s2db20dup('')outputdb0ah,0dh,'$';dataendscodesegmentuse16assumecs:code,ds:datastart:movax,datamovds,axleadx,bufmovah,0Ahint21h;copythebuftobufamovdi,1tell:leabx,bufmovax,[bx+di]leabx,bufamov[bx+di],axincdicmpax,0Dhjnetell;bufaincludetheequation;输入-movbx,0here1:cmpbuf[bx],'*'jenext1incbxjmphere1next1:movbuf[bx],0;nextstepmovbx,0here2:cmpbuf[bx],'='jenext2incbxjmphere2next2:movbuf[bx],0;changeover--firstmovbx,2movax,0movdx,0next01:movdl,buf[bx]cmpdl,0jedone01imulax,ax,10;((1*10+2)*10+3)*10+subdl,'0'addax,dxincbxjmpnext01done01:pushax;secondmovax,0movdx,0incbxnext02:movdl,buf[bx]cmpdl,0jedone02imulax,ax,10;((1*10+2)*10+3)*10+subdl,'0'addax,dxincbxjmpnext02done02:pushax;multipopaxmovbx,axpopaxmulbx;dx:ax;貌似也有eax了pushdxshledx,16popdxmovdx,axmoveax,edxpusheax;显示式子;输出bufa;bufa加尾leabx,bufamoveax,0hlittle3:incbxmoval,[bx]cmpal,3Dhjnelittle3incbxmovax,0Dhmov[bx],axincbxmovax,0Ahmov[bx],axincbxmovax,'$'mov[bx],axmovah,9;输出字符串movdx,offsetbufaadddx,2int21h;调用三个函数;输出eaxpopeaxcallto2;BUGcallto10;BUGcallto16movah,4Chint21h;=================to2procnearpusheax;保存movdi,0movcx,0;统计push的次数again:movedx,0;被除数为EDX:EAXmovebx,2divebx;EAX=商,EDX=余数adddl,'0'pushdx;存7-4-6...inccxcmpeax,0jneagainmovax,4;空格pop_again:popdx;释放2-1-4...movs[di],dlincdi;decaxcmpax,0jalittlemovax,4movs[di],32;空格incdilittle:deccxjnzpop_againmoval,'b'movs[di],alincdimoval,0Dhmovs[di],alincdimoval,0Ahmovs[di],alincdimoval,'$'movs[di],almovah,9;输出字符串movdx,offsetsint21hpopeax;还原retnto2endp;=====================to10procnearpusheaxmovdi,0movcx,0;统计push的次数again1:movedx,0;被除数为EDX:EAXmovebx,10divebx;EAX=商,EDX=余数adddl,'0'pushdx;存7-4-6...inccxcmpeax,0jneagain1pop_again1:popdx;释放2-1-4...movs1[di],dlincdideccxjnzpop_again1moval,0Dhmovs1[di],alincdimoval,0Ahmovs1[di],alincdimoval,'$'movs1[di],almovah,9;输出字符串movdx,offsets1int21hpopeaxretnto10endp;====================to16procnearpusheaxmovdi,0;数组s的下标movcx,0;统计push的次数again2:movedx,0;被除数为EDX:EAXmovebx,16divebx;EAX=商,EDX=余数adddl,'0'cmpdl,58jblittle2adddl,7;ASCLL加到ABClittle2:pushdx;存7-4-6...inccxcmpeax,0jneagain2pop_again2:popdx;释放2-1-4...movs2[di],dlincdideccxjnzpop_again2moval,'h'movs2[di],alincdimoval,0Dhmovs2[di],alincdimoval,0Ahmovs2[di],alincdimoval,'$'movs2[di],almovah,9;输出字符串movdx,offsets2int21hpopeaxretnto16endpcodeendsendstart