资源描述:
《汇编上机考试题》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、1•大小写字母转化编程,将datasg段中每个单词改为大写字母。(使用栈来暂存ex)assumecs:codesg,ds:datasg,ss:stacksgdatasgsegmentdb'ibm*db'abc'db'dos1db'vax'datasgendsstacksgsegmentdw0,0,0,0,0,0,0,0stacksgendscodesgsegmentstart:movax,stacksgmovss,axmovsp,16movax,datasgmovds,axmovbx,0movex,4s
2、O:pushexmovsi,0movex,3s:moval,[bx+si]andal,11011111bmov[bx+si],alincsiloopsaddbx,16popexloopsOmovax,4c00hint21hcodesgendsendstart2•对一个数据块进行初始化向内存0020:0-0020:3F依次传送数据0-63(3FH),程序最多只能使用9条指令。assumecs:codecodesegmentstart:movax,0020hmovds,axmovbx,0movex,64s:
3、movds:[bx],blinebxloopsmovax,4c00hint21hcodeendsendstart3.将一个数据块从一个位置复制到另一个位置将内存ffff:O-ffff:b单元中的数据复制到0:200-0:20b单元中。assumecs:codecodesegmentstart:movax,Offffhmovds,axmovax,0020hmoves,axmovbx,0movex,12s:movdl,ds:[bx]moves:[bx],dlinebxloopsmovax,4c00hint2
4、1hcodeendsendstart4•将一个数字字符转化为数值将字符串转化为对应的数字并放入内存地址空间assumecs:codesg,ds:datasgdatasgsegmentdb'0123456789'db0,0,0,0,0z0z0z0,0,0datasgendscodesgsegmentstart:movax,datasgmovds,axmovbx,0movsi,0movex,10s:moval,[bx+si]subal,30hmov[bx+10h+si],alincsiloopsmovax,
5、4c00hint21hcodesgendsendstart5•统计一个数据块中0或1的个数assumecs:codedatasegmentvadb1,1,1,1,1,0,0,0,0,2,3,7,8,9,6,6vandb?vbndb?dataendscodesegmentstart:movax,datamovds,axmovbx,0movcx,van・vas:cmpbyteptr[bx],0jnepanduanincvanpanduan:cmpbyteptr[bx],ljnenextincvbnnext:
6、incbxloopsmovax,4c00hint21hcodeendsendstart6一个数组求最大和最小数assumecs:codesg,ds:datasgdatasgsegmentadb88,89,64,6,76,54,78,65maxdb?maxdb?datasgendscodesegmentstart:movax,datasmovds,axmovsi,0movex,10movax,[si]movbx,[si]lopl:cmpax,[si]jaeIop2movax,[si]Iop2:cmpbx,
7、[si]jbeIop3movbx,[si]Iop3:addsi,llooploplmovds:[max],axmovds:[min],bxmovax,4c00hint21hcodesendsendstart7统计字符串中字符的个数assumecs:codedatasegmentdb'abed1234'dataendscodesegmentstart:movax,datamovds,axmovbx,0movdx,0movex,8s:moval,[bx]empal,61hjbsOempal,87hjasOi
8、ncdxsO:inebxloopsmovax,4c00hint21hcodeendsendstart8数组累加不用标号形式assumecs:codedatasegmentdb1,2,3,4,5,6,7,8dataendscodesegmentstart:movax,datamovds,axmovbx,0movdx,0movex,8s:moval,ds:[bx]movah,0adddx,axinebxloopsmovax,4c00hint21