1.12 High Level Assembly Language vs. Low Level Assembly


1.12 High Level Assembly Language vs. Low Level Assembly

Before concluding this chapter, it's important to remind you that none of the control statements appearing in this chapter are "real" assembly language. The 80x86 CPU does not support machine instructions like if, while, repeat, for, break, breakif, and try. Whenever HLA encounters these statements, it compiles them into a sequence of one or more true machine instructions that do the operation as the high level statements you've used. While these statements are convenient to use, and in many cases just as efficient as the sequence of low level machine instructions into which HLA translates them, don't lose sight of the fact that they are not true machine instructions.

The purpose of this text is to teach you low level assembly language programming; these high level control structures are simply a means to that end. Remember, learning the HLA high level control structures allows you to leverage your high level language knowledge early on in the educational process so you don't have to learn everything about assembly language all at once. By using high level control structures that you're already comfortable with, this text can put off the discussion of the actual machine instructions you'd normally use for control flow until much later in the text. By doing so, this text can regulate how much material it presents so, hopefully, you'll find learning assembly language to be much more pleasant. However, you must always remember that these high level control statements are just a pedagogical tool to help you learn assembly language. Though you're free to use them in your assembly programs once you master the real control flow statements, you really must learn the low level control statements if you really want to learn assembly language programming. Since, presumably, that's why you're reading this book, don't allow the high level control structures to become a crutch. When you get to the point where you learn how to really write low level control statements, embrace and use them (exclusively). As you gain experience with the low level control statements and learn their advantages and disadvantages, you'll be in a good position to decide whether a high level or low level code sequence is most appropriate for a given application. However, until you gain considerable experience with the low level control structures, you'll not be able to make an educated decision. Remember, you can't really call yourself an "Assembly Language Programmer" unless you've mastered the low level statements.

Another thing to keep in mind is that the HLA Standard Library functions are not part of the assembly language. They're just some convenient functions that have been pre-written for you. Although there is nothing wrong with calling these functions, always remember that they are not machine instructions and that there is nothing special about these routines; as you gain experience writing assembly language code, you can write your own versions of each of these routines (and even write them more efficiently).

If you're learning assembly language because you want to write the most efficient programs possible (either the fastest or the smallest code), you need to understand that you won't achieve this goal completely if you're using high level control statements and making a lot of calls to the HLA Standard Library. HLA's code generator and the HLA Standard Library aren't horribly inefficient, but the only true way to write efficient programs in assembly language is to think in assembly language. HLA's high level control statements and many of the routines in the HLA Standard Library are great because they let you avoid thinking in assembly language. While this is great while you're first leaning assembly, if your ultimate goal is to write efficient code, then you've got to learn to think in assembly language. This text will get you to that point (and does so much more rapidly because it uses HLA's high level features), but don't forget that your ultimate goal is to give up these high level features in favor of low level coding.




The Art of Assembly Language
The Art of Assembly Language
ISBN: 1593272073
EAN: 2147483647
Year: 2005
Pages: 246
Authors: Randall Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net