单片机外文翻译汇编语言的艺术译文 英文.docx

上传人:b****6 文档编号:16829752 上传时间:2023-07-17 格式:DOCX 页数:15 大小:25.82KB
下载 相关 举报
单片机外文翻译汇编语言的艺术译文 英文.docx_第1页
第1页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第2页
第2页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第3页
第3页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第4页
第4页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第5页
第5页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第6页
第6页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第7页
第7页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第8页
第8页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第9页
第9页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第10页
第10页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第11页
第11页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第12页
第12页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第13页
第13页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第14页
第14页 / 共15页
单片机外文翻译汇编语言的艺术译文 英文.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

单片机外文翻译汇编语言的艺术译文 英文.docx

《单片机外文翻译汇编语言的艺术译文 英文.docx》由会员分享,可在线阅读,更多相关《单片机外文翻译汇编语言的艺术译文 英文.docx(15页珍藏版)》请在冰点文库上搜索。

单片机外文翻译汇编语言的艺术译文 英文.docx

单片机外文翻译汇编语言的艺术译文英文

TheArtofAssemblyLanguage

1.What'sWrongWithAssemblyLanguage?

2.What'sRightWithAssemblyLanguage?

1.What'sWrongWithAssemblyLanguage

Assemblylanguagehasaprettybadreputation.Thecommonimpressionaboutassemblylanguage

programmerstodayisthattheyareallhackersormisguidedindividualswhoneedenlightenment.

Herearethereasonspeoplegivefornotusingassembly:

•

(1)Assemblyishardtolearn.

•

(2)Assemblyishardtoreadandunderstand.

•(3)Assemblyishardtodebug.

•(4)Assemblyishardtomaintain.

•(5)Assemblyishardtowrite.

•(6)Assemblylanguageprogrammingistimeconsuming.

•(7)Improvedcompilertechnologyhaseliminatedtheneedforassemblylanguage.

•(8)Today,machinesaresofastthatwenolongerneedtouseassembly.

•(9)Ifyouneedmorespeed,youshoulduseabetteralgorithmratherthanswitchtoassemblylanguage.

•(10)Machineshavesomuchmemorytoday,savingspaceusingassemblyisnotimportant.

•(11)Assemblylanguageisnotportable.

Thesearesomestrongstatementsindeed!

Giventhatthisisabookwhichteachesassemblylanguageprogramming,writtenforcollegelevelstudents,writtenbysomeonewhoappearstoknowwhathe'stalkingabout,yournaturaltendencyistobelievesomethingifitappearsinprint.Havingjustreadtheabove,you'restartingtoassumethatassemblymustbeprettybad.Andthat,dearfriend,iseightypercentofwhat'swrongwithassemblylanguage.Thatis,peopledevelopsomeverystrongmisconceptionsaboutassemblylanguagebasedonwhatthey'veheardfromfriends,instructors,articles,andbooks.Oh,assemblylanguageiscertainlynotperfect.Itdoeshavemanyrealfaults.Thosefaults,however,areblowncompletelyoutofproportionbythoseunfamiliarwithassemblylanguage.Thenexttimesomeonestartspreachingabouttheevilsofassemblylanguage,ask,"howmanyyearsofassemblylanguageprogrammingexperiencedoyouhave?

"Ofcourseassemblyishardtounderstandifyoudon'tknowit.Itissurprisinghowmanypeoplearewillingtospeakoutagainstassemblylanguagebasedonlyonconversationsthey'vehadorarticlesthey'veread.

Assemblylanguageusersalsousehighlevellanguages(HLLs);assembly'smostoutspokenopponentsrarelyuseanythingbutHLLs.Whowouldyoubelieve,anexpertwellversedinbothtypesofprogramminglanguagesorsomeonewhohasnevertakenthetimetolearnassemblylanguageanddevelopanhonestopinionofitscapabilities?

Inaconversationwithsomeone,Iwouldgotogreatlengthstoaddresseachoftheaboveissues.Indeed,inaroughdraftofthischapterIspentabouttenpagesexplainingwhatiswrongwitheachoftheabovestatements.However,thisbookislongenoughandIfeltthatverylittlewasgained

bygoingonandonaboutthesepoints.Nonetheless,abriefrebuttaltoeachoftheabovepointsisinorder,iffornootherreasonthantokeepyoufromthinkingthereisn'tadecentdefenseforthesestatements.

Assemblyishardtolearn.Soisanylanguageyoudon'talreadyknow.Trylearning(reallylearning)APL,Prolog,orSmalltalksometime.OnceyoulearnPascal,learninganotherlanguagelikeC,BASIC,FORTRAN,Modula-2,orAdaisfairlyeasybecausetheselanguagesarequitesimilartoPascal.Ontheotherhand,learningadissimilarlanguagelikePrologisnotsosimple.AssemblylanguageisalsoquitedifferentfromPascal.ItwillbealittlehardertolearnthanoneoftheotherPascal-likelanguages.However,learningassemblyisn'tmuchmoredifficultthanlearningyourfirstprogramminglanguage.

Assemblyishardtoreadandunderstand.Itsureis,ifyoudon'tknowit.Mostpeoplewhomakethisstatementsimplydon'tknowassembly.Ofcourse,it'sveryeasytowriteimpossible-to-readassemblylanguageprograms.It'salsoquiteeasytowriteimpossible-to-readC,Prolog,andAPLprograms.Withexperience,youwillfindassemblyaseasytoreadasotherlanguages.

Assemblyishardtodebug.Sameargumentasabove.Ifyoudon'thavemuchexperiencedebuggingassemblylanguageprograms,it'sgoingtobehardtodebugthem.RememberwhatitwaslikefindingbugsinyourfirstPascal(orotherHLL)programs?

Anytimeyoulearnanewprogramminglanguageyou'llhaveproblemsdebuggingprogramsinthatlanguageuntilyougain

experience.

Assemblyishardtomaintain.Cprogramsarehardtomaintain.Indeed,programsarehardtomaintainperiod.Inexperiencedassemblylanguageprogrammerstendtowritehardtomaintainprograms.Writingmaintainableprogramsisn'tatalent.It'saskillyoudevelopthroughexperience.

Assemblylanguageishard.Thisstatementactuallyhasaringoftruthtoit.Forthelongesttimeassemblylanguageprogrammerswrotetheirprogramscompletelyfromscratch,often"re-inventingthewheel."HLLprogrammers,especiallyC,Ada,andModula-2programmers,havelongenjoyedthebenefitsofastandardlibrarypackagewhichsolvesmanycommonprogrammingproblems.Assemblylanguageprogrammers,ontheotherhand,havebeenknowntorewriteanintegeroutputroutineeverytimetheyneedone.Thisbookdoesnottakethatapproach.Instead,ittakesadvantageofsomeworkdoneattheUniversityofCalifornia,Riverside:

theUCRStandardLibraryfor80x86AssemblyLanguageProgrammers.ThesesubroutinessimplifyassemblylanguagejustastheCstandardlibraryaidsCprogrammers.ThelibrarysourcelistingsareavailableelectronicallyviaInternetandvariousothercommunicationservicesaswellasona

companiondiskette.

Assemblylanguageprogrammingistimeconsuming.Softwareengineersestimatethatdevelopersspendonlyaboutthirtypercentoftheirtimecodingasolutiontoaproblem.EvenifittooktwiceasmuchtimetowriteaprograminassemblyversussomeHLL,therewouldonlybeafifteenpercentdifferenceinthetotalprojectcompletiontime.Infact,goodassemblylanguageprogrammersdonotneedtwiceasmuchtimetoimplementsomethinginassemblylanguage.ItistrueusingaHLLwillsavesometime;however,thesavingsisinsufficienttocounterthebenefitsofusingassemblylanguage.

Improvedcompilertechnologyhaseliminatedtheneedforassemblylanguage.Thisisn'ttrueandprobablyneverwillbetrue.Optimizingcompilersaregettingbettereveryday.However,assemblylanguageprogrammersgetbetterperformancebywritingtheircodedifferentlythantheywouldiftheywereusingsomeHLL.IfassemblylanguageprogrammerswrotetheirprogramsinCandthentranslatedthemmanuallyintoassembly,agoodCcompilerwouldproduceequivalent,orevenbetter,code.Thosewhomakethisclaimaboutcompilertechnologyarecomparingtheir

hand-compiledcodeagainstthatproducedbyacompiler.Compilersdoamuchbetterjobofcompilingthanhumans.Thenagain,you'llnevercatchanassemblylanguageprogrammerwriting"CcodewithMOVinstructions."Afterall,that'swhyyouuseCcompilers.

Today,machinesaresofastthatwenolongerneedtouseassembly.Itisamazingthatpeoplewillspendlotsofmoneytobuyamachineslightlyfasterthantheonetheyown,buttheywon'tspendanyextratimewritingtheircodeinassemblysoitrunsfasteronthesamehardware.There

aremanyragingdebatesaboutthespeedofmachinesversusthespeedofthesoftware,butonefactremains:

usersalwayswantmorespeed.Onanygivenmachine,thefastestpossibleprogramswillbewritteninassemblylanguage.

Ifyouneedmorespeed,youshoulduseabetteralgorithmratherthanswitchtoassemblylanguage.Whycan'tyouusethisbetteralgorithminassemblylanguage?

Whatifyou'realreadyusingthebestalgorithmyoucanfindandit'sstilltooslow?

Thisisatotallybogusargument

againstassemblylanguage.AnyalgorithmyoucanimplementinaHLLyoucanimplementinassembly.Ontheotherhand,therearemanyalgorithmsyoucanimplementinassemblywhichyoucannotimplementinaHLL.

Assemblylanguageisnotportable.Thisisanundeniablefact.An80x86assemblylanguageprogramwrittenforanIBMPCwillnotrunonanAppleMacintosh.Indeed,assemblylanguageprogramswrittenfortheAppleMacintoshwillnotrunonanAmiga,eventhoughtheysharethesame680x0microprocessor.Ifyouneedtorunyourprogramondifferentmachines,you'llhavetothinklongandhardaboutusingassemblylanguage.UsingC(orsomeotherHLL)isnoguaranteethatyourprogramwillbeportable.CprogramswrittenfortheIBMPCwon'tcompileandrunonaMacintosh.Andeveniftheydid,mostMacownerswouldn'taccepttheresult.

Portabilityisprobablythebiggestcomplaintpeoplehaveagainstassemblylanguage.Theyrefusetouseassemblybecauseitisnotportable,andthentheyturnaroundandwriteequallynon-portableprogramsinC.

Yes,therearelotsoflies,misconceptions,myths,andhalf-truthsconcerningassemblylanguage.Whateveryoudo,makesureyoulearnassemblylanguagebeforeformingyourownopinions.Speakingoutinignorancemayimpressotherswhoknowlessthanyoudo,butitwon'timpressthosewhoknowthetruth.

2What'sRightWithAssemblyLanguage?

Anoldjokegoessomethinglikethis:

"Therearethreereasonsforusingassemblylanguage:

speed,

speed,andmorespeed."Eventhosewhoabsolutelyhateassemblylanguagewilladmitthatif

speedisyourprimaryconcern,assemblylanguageisthewaytogo.Assemblylanguagehasseveralbenefits:

•

(1)Speed.Assemblylanguageprogramsaregenerallythefastestprogramsaround.

•

(2)Space.Assemblylanguageprogramsareoftenthesmallest.

•(3)Capability.YoucandothingsinassemblywhicharedifficultorimpossibleinHLLs.

•(4)Knowledge.Yourknowledgeofassemblylanguagewillhelpyouwritebetterprograms,evenwhenusingHLLs.

Assemblylanguageistheuncontestedspeedchampionamongprog

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2