资源描述:
《北理工8086汇编语言上机试题及答案(二)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1.请任意输入一个字符串,将其中大写字母换成小写字母,并将结果显示在屏幕上。2.请任意输入一个字符串,将其中的英文字母全部删除,并将结果显示在屏幕上。3.现有一组字符串为data,name,time,file,code,path,user,exit,quit,text,请编写程序从键盘输入4个字符的字符串,若存在将其修改为disk,并在显示器上显示。4.现有一组字符串为ram,yes,red,the,get,for,and,key,not,may,请编写程序将他们按ASCII大小排序,并在显示器上显示。5.现有
2、一组字符串为data,name,time,file,code,path,user,exit,quit,text,请编写程序从键盘输入4个字符的字符串,若存在将其删除,并在显示器上显示。6.现有一组字符串为data,name,time,file,code,path,user,exit,quit,text,请编写程序将上述字符串排序(升序)并插入disk使其人仍然有序,并在显示器上显示。答案部分:Answer1:DATASEGMENTBUFDB0FFHDB?DB0FFHDUP(?)STROUTDB0DH,0AH,0
3、FDHDUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXLEADX,BUFMOVAH,0AHINT21HLEASI,BUF[2]LEADI,STROUT[2]MOVCL,BUF[1]XORCH,CHAGAIN:CMPBYTEPTR[SI],'A'JBNOTUPCMPBYTEPTR[SI],'Z'JANOTUPMOVAL,[SI]ADDAL,20HMOV[DI],ALJMPNEXTNOTUP:MOVAL,[SI]MOV[DI
4、],ALNEXT:INCSIINCDILOOPAGAINMOVBYTEPTR[DI],'$'LEADX,STROUTMOVAH,09HINT21HMOVAH,4CHINT21HCODEENDSENDSTARTAnswer2:DATASEGMENTBUFDB0FFHDB?DB0FFHDUP(?)STROUTDB0DH,0AH,0FDHDUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXLEADX,BUFMOVAH,0AHINT
5、21HLEASI,BUF[2]LEADI,STROUT[2]MOVCL,BUF[1]XORCH,CHAGAIN:CMPBYTEPTR[SI],'A'JBNOTUPCMPBYTEPTR[SI],'Z'JANOTUPINCSIJMPNEXTNOTUP:CMPBYTEPTR[SI],'a'JBNOTALPHACMPBYTEPTR[SI],'z'JANOTALPHAINCSIJMPNEXTNOTALPHA:MOVAL,[SI]MOV[DI],ALINCSIINCDINEXT:LOOPAGAINMOVBYTEPTR[DI
6、],'$'LEADX,STROUTMOVAH,09HINT21HMOVAH,4CHINT21HCODEENDSENDSTARTAnswer3:DATASEGMENTBUFDB05HDB?DB05HDUP(?)STROUTDB0DH,0AH,'data'DB0DH,0AH,'name'DB0DH,0AH,'time'DB0DH,0AH,'file'DB0DH,0AH,'code'DB0DH,0AH,'path'DB0DH,0AH,'user'DB0DH,0AH,'exit'DB0DH,0AH,'quit'DB0D
7、H,0AH,'text','$'REPLACEDB'disk'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,ES:DATASTART:MOVAX,DATAMOVDS,AXMOVES,AXLEADX,BUFMOVAH,0AHINT21HLEABX,STROUT[2]LEASI,BUF[2]LEADI,STROUT[2]MOVCX,10AGAIN:CLDPUSHCXMOVCX,4REPZCMPSBPOPCXJNZNEXTLEASI,REPLACEMOVDI,BXMOVDX,4SU
8、BAGAIN:MOVAL,[SI]MOV[DI],ALINCSIINCDIDECDXJNZSUBAGAINJMPEXITNEXT:LEASI,BUF[2]ADDBX,6MOVDI,BXLOOPAGAINEXIT:LEADX,STROUTMOVAH,09HINT21HMOVAH,4CHINT21HCODEENDSENDSTARTAnswer4:DATASEGMENTBUFDB0DH,0A