80X86汇编语言电子教案(6-子程序设计)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

1PROCENDPNEARFARNEAR1NEAR2FAR2PROCENDP31FAR2MAINPROCFAR…CALLSUBR1…RETMAINENDPSUBR1PROCNEAR…RETSUBR1ENDPMAINPROCFAR…CALLSUBR1…RETSUBR1PROCNEAR…RETSUBR1ENDPMAINENDPCALLRETSEGXSEGMENT…SUBTPROCFAR…RETSUBTENDP…CALLSUBT…SEGXENDSSEGYSEGMENT…CALLSUBT…SEGYENDSCALLDSTRETDST,JMPIPEIPCSIPEIPJMPJMPLLLLCALLLLLLPROCFARRET1CALLDSTCALLCALLDSTDSTIPEIPDSTIPEIPCALLWORDPTR[BX]CALLBXRET2RETCALLDSTRETRETIPEIPRETRETEXP1RETEXP2IPEIPSPESPSPESPSPESP+EXPMAINPRO_APRO_BPRO_CMAINCALLFARPTRPRO_A(IP)=1000(CS)=0500PRO_ACALLNEARPTRPRO_B(IP)=2500CALLNEARPTRPRO_C(IP)=3700RETPRO_ACALLNEARPTRPRO_B(IP)=2500CALLNEARPTRPRO_C(IP)=3700RETPRO_BCALLNEARPTRPRO_C(IP)=4000RETPRO_CRETCALLRET(1)(2)PROADDDATASEGENTARYDW100DUPCOUNTDW100SUMDWDATAENDSCODESEGMENTMAINPROCFARASSUMECSCODEDSCODESTART…CALLPROADD…RETMAINENDPCODEENDSENDSTART……PROADDPROCFARLEASIARYMOVCXCOUNTXORAXAXNEXTADDAX[SI]ADDSI2LOOPNEXTMOVSUMAXRETPROADDENDPPROADDARYDW100DUP(?)COUNTDW100SUMDWMAINPROCFARASSUMECSCODEDSCODESTARTCALLPROADDRETMAINENDPADDAXCXMOVDXAX……AXMAINPROCFARASSUMECSCODEDSCODESTARTCALLPROADDRETMAINENDPADDAXCXMOVDXAX……?PROADDPROCFARPROADDENDPPUSHAXPUSHCXPUSHSIPOPSIPOPCXPOPAX(1)RETPROADDPROCFARPROADDENDPPUSHAXPUSHCXPUSHSIPOPSIPOPCX(2)RET12123COMMONPUBLIC11AXAXPROADDPROCFARPROADDENDPPUSHAXPUSHCXPUSHSIPOPSIPOPCXPOPAXAXDATASEGENTARYDW100DUPCOUNTDW100SUMDWDATAENDSCODESEGMENTMAINPROCFARCALLPROADDRETMAINENDPNUMDW100DUPNDW100TOTALDW……2DATASEGENTARYDW100DUPCOUNTDW100SUMDWDATAENDSCODESEGMENTMAINPROCFARCALLPROADDRETMAINENDP…TABLEDW3DUP…2CODESEGMENTMAINPROCFARCALLPROADDRETMAINENDP……MOVTABLEOFFSETARYMOVTABLE+2OFFSETCOUNTMOVTABLE+4OFFSTESUMMOVBXOFFSETTABLESUMCOUNTARYBXTABLEPROADDPROCFARPROADDENDPPUSHAXPUSHCXPUSHSIPOPSIPOPCXPOPAXSUMCOUNTARYBXTABLERETPROADDPROCFARPROADDENDPMOVSI[BX]MOVDI[BX+2]MOVCX[DI]MOVDI[BX+4]……XORAXAXNEXTADDAX[SI]ADDSI2LOOPNEXTMOV[DI]AXSUMCOUNTARYBXTABLE123MAINPROCFARCALLPROADDRETMAINENDP…MOVBXOFFSETARYPUSHBXMOVBXOFFSETCOUNTPUSHBXMOVBXOFFSETSUMPUSHBX…3PROADDPROCFARPROADDENDPMOVSI[BP+0AH]MOVDI[BX+8]MOVCX[DI]MOVDI[BP+6]PUSHBPMOVBPSPPUSHAXPUSHCXPUSHSIPUSHDIRET6…ARYCOUNTSUMCSIPBPAX…BP2COMMONPUBLICPUBLIC[]EXTRN[]1;sourcemodule1Extrnvar2:word,lab2:farpublicvar1,lab1Data1segmentVar1db?Var3dw?Var4dw?Data1endsCode1segmentCode1endsEndstartModule1lab1;sourcemodule2Extrnvar1:byte,var4:wordpublicvar2Data2segmentVar2dw0Var3db5dup(?)Data2endsCode2segmentCode2endsEndModule2PUBLIC;sourcemodule3Extrnlab1:farpubliclab2,lab3Code3segmentCode3endsEndModule3EXTRNEXTRN2COMMONPUBLICPROCENDPCALLDSTRET(1)(2)12123COMMONPUBLIC

1 / 19
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功