Macros - The HLA Compile-Time Language Macros 8.1 Chapter...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
The HLA Compile-Time Language Beta Draft - Do not distribute © 2001, By Randall Hyde Page 969 Macr os Chapter Eight 8.1 Chapter Overview This chapter continues where the pre vious chapter left of f – continuing to discuss the HLA compile time language. This chapter discusses what is, perhaps, the most important component of the HLA compile-time language, macros. Man y people judge the po wer of an assembler by the po wer of its macro processing capa - bilities. If you happen to be one of these people, you’ ll probably agree that HLA is one of the more po werful assemblers on the planet after reading this chapter; because HLA has one of the most po werful macro pro - cessing f acilities of an y computer language processing system. 8.2 Macros (Compile-Time Procedures) Macros are symbols that a language processor replaces with other te xt during compilation. Macros are great de vices for replacing long repetiti v e sequences of te xt with much shorter sequences of te xt. In addi - tional to the traditional role that macros play (e.g., "#defi ne" in C/C++), HLA s macros also serv e as the equi v alent of a compile-time language procedure or function. Therefore, macros are v ery important in HLA s compile-time language; just as important as functions and procedures are in other high le v el lan - guages. Although macros are nothing ne w , HLA s implementation of macros f ar e xceeds the macro processing capabilities of most other programming languages (high le v el or lo w le v el). The follo wing sections e xplore HLA s macro processing f acilities and the relationship between macros and other HLA CTL control con - structs. 8.2.1 Standard Macros HLA supports a straight-forw ard macro f acility that lets you defi ne macros in a manner that is similar to declaring a procedure. A typical, simple, macro declaration tak es the follo wing form: #macro macroname ; << macro body >> #endmacro; Although macro and procedure declarations are similar , there are se v eral immediate dif ferences between the tw o that are ob vious from this e xample. First, of course, macro declarations use the reserv ed w ord #MA CR O rather than PR OCEDURE. Second, you do not be gin the body of the macro with a "BEGIN macr oname ;" clause. This is because macros don’ t ha v e a declaration section lik e procedures so there is no need for a k e yw ord that separates the macro declarations from the macro body . Finally , you will note that macros end with the "#ENDMA CR O" clause rather than "END macr oname ;" The follo wing is a concrete e xample of a macro declaration: #macro neg64; neg( edx ); neg( eax ); sbb( 0, edx ); #endmacro;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter Eight Volume Four Page 970 © 2001, By Randall Hyde Beta Draft - Do not distribute Ex ecution of this macro’s code will compute the two’s complement of the 64-bit value in EDX:EAX (see “Extended Precision NEG Operations” on page 872). To execute the code associated with
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 34

Macros - The HLA Compile-Time Language Macros 8.1 Chapter...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online