资源描述:
《实验2汇编语言程序的调试与运行》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1.源程序如下:DATASEGMENTADB5CH,85H;;两字节运算数BDB43H,0ABHDATAENDSCODESEGMENTASSUMECS:CODE,ds:DATASTART:MOVAX,DATAMOVDS,AXMOVSI,0;;置位移量初值MOVAL,A[SI];;取加数低位ADDAL,B[SI];,;两数相加MOVA[SI],AL;;存回A单元INCSI;;调整位移量MOVAL,A[SI];;取加数高位ADCAL,B[SI];;带进位加MOVA[SI],AL;;存回A单元MOVAH,4CHINT21HCODEENDSENDSTART;另外
2、两种方法的第(1)种方法DATASEGMENTADw855CH;;两字节运算数BDB0AB43HDATAENDSCODESEGMENTASSUMECS:CODE,ds:DATASTART:MOVAX,DATAMOVDS,AXMOVAx,AADDAx,BMOVA,axMOVAH,4CHINT21HCODEENDSENDSTART另外两种方法的第(2)种方法2、计算表达式(X+Y-10*Z)/*2的值的程序。DATASEGMENTXDd200YDd-100ZDW5aDW?bDW?DATAENDSSTACKSEGMENTSTACKDB200DUP(0)STAC
3、KENDSCODESEGMENTASSUMEDS:DATA,CS:CODE,SS:STACKSTART:MOVAX,DATAMOVDS,AX;DATA→AXMOVAX,wordptrXmovdx,wordptrx+2addax,wordptryadcdx,wordptry+2pushaxpushdxmovax,10imulzpopbxpopcxsubcx,axsbbbx,dxxchgax,cxxchgdx,bxmovbx,2idivbxmova,axmovb,bxMOVAH,4CHINT21HCODEENDS;退出DOS状态ENDSTART3、DATAS
4、EGMENTORG4000HADB?ORG4001HBDB?DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXMOVAL,00HMOVA,ALMOVBL,40HMOVB,BLMOVAH,4CHINT21HCODEENDSENDSTART