资源描述:
《要求掌握的汇编语言程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、汇编语言程序设计1将串'HELLO!'由原位置复制至目的位置DATASEGMENTSRC_MESSDB'HELLO!'DATAENDSEXTRASEGMENTNEW_LOCDB6DUP(?)EXTRAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,ES:EXTRASTART:MOVAX,DATAMOVDS,AXMOVAX,EXTRAMOVES,AXLEASI,SRC_MESSLEADI,NEW_LOCMOVCX,6CLDREPMOVSBMOVAH,4CHINT21HCODEENDSENDST
2、ART2将内存BUF1中的16进制数反向传送到BUF2中,要求BUF1的内容不被破坏,并统计BUF1中1的个数,(程序中,要求自己定义BUF1中数的数值)。参看课本122页,第三章习题12。DATASEGMENTBUF1DW42F8HBUF2DW?NUMDB0DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXMOVCX,16MOVBX,0MOVAX,BUF1next:RORAX,1JNCCOUNTINCBL5COUNT:RCLDX,1LOO
3、PnextMOVBUF2,DXMOVNUM,BLMOVAH,4CHINT21HCODEENDSENDSTART3编程实现下列函数的功能,其中X、Y为无符号字节数DATSEGMENTXDB24HYDB67HZDB?DATENDSCODSEGMENTASSUMEDS:DAT,CS:CODMAINPROCFARPUSHDS;保存返回地址SUBAX,AXPUSHAXMOVAX,DATMOVDS,AX;初始化DSMOVAL,XMOVBL,YCMPAL,BLJEC1;(AL)=(BL)则跳转至C1,否则继续执行JAC2;(AL)
4、>(BL)则跳转至C2,否则继续执行MOVAL,-1JMPEXTC1:MOVAL,0JMPEXTC2:MOVAL,1EXT:MOVZ,ALRET;返回DOS5MAINENDPCODENDSENDMAIN4八个数放在数据段中,求它们的和、最大值和最小值并放在数据段中(程序中,要求自己定义八个数的数值)。DATASEGMENTARRAYDW353H,124H,512H,268H,600H,953H,740H,862HSUMDW?MAXDW?MINDW?DATAENDSCODESEGMENTASSUMECS:CODE,DS
5、:DATASTART:MOVAX,DATAMOVDS,AXMOVCX,7MOVSI,0MOVAX,ARRAY[SI];SUMMOVBX,ARRAY[SI];MAXMOVDX,ARRAY[SI];MINNEXT:INCSIINCSIADDAX,ARRAY[SI]CMPBX,ARRAY[SI]JGJMINMOVBX,ARRAY[SI]JMIN:CMPDX,ARRAY[SI]JLLPMOVDX,ARRAY[SI]LP:LOOPNEXTMOVSUM,AXMOVMAX,BXMOVMIN,DXMOVAH,4CHINT21HCOD
6、EENDSENDSTART5用过程调用方法,对数据段两个N字节BCD码数求和(程序中,要求自己定义两个数的数值)。DATASEGMENTONEDB55H,22H,11H,44H5TWODB11H,88H,99H,22HSUMDB4DUP(?)NDW4DATAENDSSTACKSEGMENTSTACK'STACK'STTDB100DUP(?)TOPEQULENGTHSTTSTACKENDSCODESEGMENTMAINPROCFARASSUMECS:CODE,DS:DATA,SS:STACKSTART:MOVAX,ST
7、ACKMOVSS,AXMOVSP,TOPPUSHDSSUBAX,AXPUSHAXMOVAX,DATAMOVDS,AXMOVES,AXLEASI,ONELEABX,TWOLEADI,SUMCLDCLCMOVCX,NLP:CALLADDBCDLOOPLPRETMAINENDPENDSTARTADDBCDPROCNEARLODSBADCAL,[BX]DAASTOSBINCBXRETADDBCDENDP6从键盘输入字符存入内存缓冲区并同时显示在屏幕上,输入‘$’时停止。5DATASEGMENTBUFDB80DUP(0)DAT
8、AENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXLEASI,BUFINPUT:MOVAH,01INT21HMOV[SI],ALINCSICMPAL,'$'JNZINPUTMOVDL,2AH;'*'MOVAH,02HINT21HMOVAH,4CHINT21HCODEENDS