In previous chapters, we developed some fundamental topics of computer architecture and illustrated them with brief Itanium assembly language programs. Yet all of the programs presented thus far have been unrepresentative of real-world programs in one crucial respect: They did not contain any data-dependent decisions that might have dynamically altered the flow of control. In a high-level language, control structures may include loops (while…do or do…until) and logical or data-dependent decision constructs (if…then…else and case choices). In this and later chapters we are going to see how those powerful constructs for designing and imparting orderliness to computer programs can be built up from very small beginnings, using the machine-language branch instructions in combination with certain numerical comparisons and logical operations. A warning to the faint of heart: For several decades, important advances in the methodology of programming in high-level languages have led to the modern canon of near-total avoidance of that loose cannon of older programming tools, the goto statement. Newer languages have even been developed with scarcely any direct equivalent. Behind the scenes, however, compilers for virtually all languages implement their high-level control structures using low-level variants of goto that is, the branch instructions of machine language. Appreciating this paradox, perhaps with amusement but definitely with thorough understanding, will be a major take-away lesson from your study of assembly language programming. |