资源描述:
《汇编语言实验报告源代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、分支程序设计■字母字符转换-源码:.386.MODELFLATExitProcessPROTONEAR32stdcall,dwExitCode:DWORDINCLUDEio.hcrEQUOdhLfEQUOah.STACK4096.DATA;headerfileforinput/output;carriagereturncharacter;linefeed;reserve4096-bytestackpromotwarninganswerLtoUBYTE"Enteracharofletterfcr,Lf,0BYTE"Thecharisn'taletter,ente
2、ragain”,0BYTEHThecharisalowercase,it'suppercaseis11BYTEcr,Lf,0answerUtoLcharBYTEHThecharisauppercase,ifslowercaseisHBYTEcr,Lf,0BYTE1DUP(?).CODE;与41h(A)比较;若charz,跳转到重新输入;跳转到小写字母转换为大写字母部分;输出错误信息提示语句;输入数据;跳转到比较部分
3、_start:outputpromotinputchar,1doGo:movbl.charinputchar,1cmpchar,OdhjedoWhCMPjmpdoGodoWhCMP:cmpbl,41hjlinputAgaincmpbl,5AhjleendUppertoLcmpLower:cmpbl,61hjlinputAgaincmpbl,7AhjginputAgainjmpendLowertoUinputAgain:outputwarninginputchar,1movbl,charjmpdoGoendUppertoL:;输出提示语句;输入数据;与Odh比较;
4、若相等,跳转到doWhCMP;重新输入数据moval,bladdal,32;ASCII码加32movchar,aloutputanswerUtoL;输出结果提示语句outputchar;输出结果jmpendMain;跳转到结束部分endLowertoU:moval,blsubal,32;ASCII码减32movchar,aloutputanswerLtoU;输出结果提示语句outputchar;输出结果endMain:INVOKEExitProcess,0;exitwithreturncode0PUBLIC_start;makeentrypointpublicE
5、ND;endofsourcecode循环程序设计■显示九九乘法表-源码:.386.MODELFLATExitProcessPROTONEAR32stdcall,dwExitCode:DWORDINCLUDEio.hcrEQUOdhLfEQUOahcomeBYTE"Welcometomultiplicationtable!n,cr,Lf,0sumBYTE6DUP(?),0firstBYTE6DUP(?),0secondBYTE6DUP(?),0rowWORD9•lieWORD9•prompt1BYTE”*”,0prompt2BYTE”二”,0prompt3BYTE
6、cr,Lf,0prompt4BYTE””,0.CODE_start:outputcome;输出欢迎语句.STACK4096•DATAoutputprompt3;换行movrow,1;将行数初始值赋值为1movlie,1;将列数初始值赋值为1fo:cmprow,9jgquitmovbx,rowitoafirst,bxoutputfirst+5outputprompt1;行数与9相比较;若行数等于9则退出循环;bx寄存器中存储行数;将bx的值转换为ASCII码值存储到first中;输出行数;输出乘号movcxjieitoasecond,exoutputsecond+
7、5outputprompt2;cx寄存器中存储列数;将ex的值转换为ASCII码值存储到second中;输出列数;输出等号movax,cximulbxitoasum,axoutputsum+4outputprompt4;将ex寄存器中的列数移到ax寄存器为乘法做准备;做乘法bx*ax即行数*列数;将结果转换为ASCII码值存储到sum中;输出乘积运算结果;输出空格cmpbx,cx;行数与列数值进行比较jeto;若相等则跳转到换行输出部分inclie汐U数自增jmpfo;继续循环to:outputprompt3incrowmovlieJjmpfo;输岀换行;行数自
8、增;列数初始化为1;进入