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

上传人:b****9 文档编号:25711864 上传时间:2023-06-11 格式:DOCX 页数:13 大小:25.09KB
下载 相关 举报
单片机外文翻译汇编语言的艺术译文 英文实用资料.docx_第1页
第1页 / 共13页
单片机外文翻译汇编语言的艺术译文 英文实用资料.docx_第2页
第2页 / 共13页
单片机外文翻译汇编语言的艺术译文 英文实用资料.docx_第3页
第3页 / 共13页
单片机外文翻译汇编语言的艺术译文 英文实用资料.docx_第4页
第4页 / 共13页
单片机外文翻译汇编语言的艺术译文 英文实用资料.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

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

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

单片机外文翻译汇编语言的艺术译文 英文实用资料.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.

Assemblylanguageistheuncontestedspeedchampionamong

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

当前位置:首页 > 党团工作 > 党团建设

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1