微机原理ch03assemblylanguageprogramming

微机原理ch03assemblylanguageprogramming

ID:30423099

大小:450.04 KB

页数:15页

时间:2018-12-29

微机原理ch03assemblylanguageprogramming_第1页
微机原理ch03assemblylanguageprogramming_第2页
微机原理ch03assemblylanguageprogramming_第3页
微机原理ch03assemblylanguageprogramming_第4页
微机原理ch03assemblylanguageprogramming_第5页
资源描述:

《微机原理ch03assemblylanguageprogramming》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、3ASSEMBLYLANGUAGEPROGRAMMING3.1DIRECTIVESANDSAMPLEPROGRAMAgivenassemblylanguageprogramisaseriesofstatements,orlines,whichareeitherassemblylanguageinstructionssuchasMOVorADD,orstatementscalleddirectives.;THEFORMOFANASSEMBLYLANGUAGEPROGRAM;NOTE:USINGSIMPLIFIEDSEGMENTDEFINITION.modelsm

2、all.stack64.datadata1db52hdata2db29hsumdb?.codemainprocfar;thisistheprogramentrypointmovax,@data;loadthedatasegmentmovds,ax;assignvaluetoDSmoval,data1;getthefirstoperandmovbl,data2;getthesecondoperandaddal,bl;addtheoperandsmovsum,al;storetheresultinlocationSUMmovah,4ch;setuptoreturn

3、DOSint21hmainendpp1procfarp1endpp2procfarp2endpendmain;thisistheprogramexitpoint图31SimpleassemblylanguageprogramDirectives(alsocalledpseudo-instructions)givedirectionstotheassemblerabouthowitshouldtranslatetheassemblylanguageinstructionsintomachinecode.Anassemblylanguageinstruction

4、consistsoffourfields:[label:]mnemonic[operands][;comment]3-15Bracketsindicatethatthefieldisoptional.lThelabelfieldallowsprogramtorefertoalineofcodebyname.Thelabelfieldcannotexceed31characters.lLabelsfordirectivesdonotneedendwithacolon.lAlabelmustendwithacolonwhenitreferstoanopcodege

5、neratinginstruction;thecolonindicatestotheassemblerthatthisreferstocodewiththiscodesegment.lTheassemblylanguagemnemonic(instruction)andoperand(s)fieldstogetherperformtherealworkoftheprogramandaccomplishthetasksforwhichtheprogramwaswritten.Inassemblylanguagesuchas:addal,blmovax,6764A

6、DDandMOVarethemnemonicopcodes,and“al,bl”and“ax,6764”aretheoperands.Thesetwofieldscouldcontainassemblerpseudo-instructions,ordirectives.Theyareusedbytheassemblertoorganizetheprogramaswellasotheroutputfiles.Directivesdonotgenerateanymachinecodeandareusedonlybytheassembler,suchasDB,END

7、.lThecommentfieldbeginswitha“;”theassemblerignorescomments3.1.1ModeldefinitionThefirststatementin图31afterthecommentsistheMODELdirective.Thisdirectiveselectsthesizeofthememorymodel.Amongtheoptionsforthememorymodelare:.modelsmall;thisdirectivedefinesthemodeassmallSMALLisoneofthemostw

8、idelyusedmemorymode

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。