1、附录 科技文献翻译 英文 The Art of Assembly Language 1. Whats Wrong With Assembly Language? 2. Whats Right With Assembly Language? 1. Whats Wrong With Assembly Language Assembly language has a pretty bad reputation. The common impression about assembly language programmers today is that they are all hackers or
2、 misguided individuals who need enlightenment. Here are the reasons people give for not using assembly: ( 1) Assembly is hard to learn. ( 2) Assembly is hard to read and understand. ( 3) Assembly is hard to debug. ( 4) Assembly is hard to maintain. ( 5) Assembly is hard to write. ( 6) Assembly langu
3、age programming is time consuming. ( 7) Improved compiler technology has eliminated the need for assembly language. ( 8) Today, machines are so fast that we no longer need to use assembly. ( 9) If you need more speed, you should use a better algorithm rather than switch to assembly language. ( 10) M
4、achines have so much memory today, saving space using assembly is not important. ( 11) Assembly language is not portable. These are some strong statements indeed! Given that this is a book which teaches assembly language programming, written for college level students, written by someone who appears
5、 to know what hes talking about, your natural tendency is to believe something if it appears in print. Having just read the above, youre starting to assume that assembly must be pretty bad. And that, dear friend, is eighty percent of whats wrong with assembly language. That is, people develop some v
6、ery strong misconceptions about assembly language based on what theyve heard from friends, instructors, articles, and books. Oh, assembly language is certainly not perfect. It does have many real faults. Those faults, however, are blown completely out of proportion by those unfamiliar with assembly
7、language. The next time someone starts preaching about the evils of assembly language, ask, how many years of assembly language programming experience do you have? Of course assembly is hard to understand if you dont know it. It is surprising how many people are willing to speak out against assembly
8、 language based only on conversations theyve had or articles theyve read. Assembly language users also use high level languages (HLLs); assemblys most outspoken opponents rarely use anything but HLLs. Who would you believe, an expert well versed in both types of programming languages or someone who
9、has never taken the time to learn assembly language and develop an honest opinion of its capabilities? In a conversation with someone, I would go to great lengths to address each of the above issues.Indeed, in a rough draft of this chapter I spent about ten pages explaining what is wrong with each o
10、f the above statements. However, this book is long enough and I felt that very little was gained by going on and on about these points. Nonetheless, a brief rebuttal to each of the above points is in order, if for no other reason than to keep you from thinking there isnt a decent defense for these s
11、tatements. Assembly is hard to learn. So is any language you dont already know. Try learning (really learning) APL, Prolog, or Smalltalk sometime. Once you learn Pascal, learning another language like C, BASIC, FORTRAN, Modula-2, or Ada is fairly easy because these languages are quite similar to Pas
12、cal. On the other hand, learning a dissimilar language like Prolog is not so simple.Assembly language is also quite different from Pascal. It will be a little harder to learn than one of the other Pascal-like languages. However, learning assembly isnt much more difficult than learning your first pro
13、gramming language. Assembly is hard to read and understand. It sure is, if you dont know it. Most people who make this statement simply dont know assembly. Of course, its very easy to write impossible-to-read assembly language programs. Its also quite easy to write impossible-to-read C, Prolog, and
14、APL programs. With experience, you will find assembly as easy to read as other languages. Assembly is hard to debug. Same argument as above. If you dont have much experience debugging assembly language programs, its going to be hard to debug them. Remember what it was like finding bugs in your first
15、 Pascal (or other HLL) programs? Anytime you learn a new programming language youll have problems debugging programs in that language until you gain experience. Assembly is hard to maintain. C programs are hard to maintain. Indeed, programs are hard to maintain period. Inexperienced assembly languag
16、e programmers tend to write hard to maintain programs. Writing maintainable programs isnt a talent. Its a skill you develop through experience. Assembly language is hard. This statement actually has a ring of truth to it. For the longest time assembly language programmers wrote their programs comple
17、tely from scratch, often re-inventing the wheel. HLL programmers, especially C, Ada, and Modula-2 programmers, have long enjoyed the benefits of a standard library package which solves many common programming problems. Assembly language programmers, on the other hand, have been known to rewrite an i
18、nteger output routine every time they need one. This book does not take that approach. Instead, it takes advantage of some work done at the University of California, Riverside: the UCR StandardLibrary for 80x86 Assembly Language Programmers. These subroutines simplify assembly language just as the C
19、 standard library aids C programmers. The library source listings are available electronically via Internet and various other communication services as well as on a companion diskette. Assembly language programming is time consuming. Software engineers estimate that developers spend only about thirt
20、y percent of their time coding a solution to a problem. Even if it took twice as much time to write a program in assembly versus some HLL, there would only be a fifteen percent difference in the total project completion time. In fact, good assembly language programmers do not need twice as much time to implement something in assembly language. It is true using a HLL will save some time; however, the savings is insufficient to counter the benefits of using assembly language.